Question

I'm trying to perform search on a single list using FullTextSqlQuery. I found example here, but given this query:

"SELECT Title,ContentType,Path FROM portal..scope() WHERE freetext('" + query + "') AND (CONTAINS(Path,'\"" + list.RootFolder.ServerRelativeUrl + "\"'))"

which for example could look like this:

SELECT Title,ContentType,Path FROM portal..scope() WHERE freetext('samochód') AND (CONTAINS(Path,'"/BW/Lists/Pytania Bazy Wiedzy"'))

but I'm getting unhandled exception on query execution:

Unhandled Exception: Microsoft.SharePoint.Search.Query.QueryMalformedException: Your query is malformed. Please rephrase your query.

This is my first contact with performing search programatically so I have no idea what might be wrong with this query. Any information and help will be appreciated.

Was it helpful?

Solution

I think the portal.. part isn't correct and try specifying a column for the freetext predicate like this:

SELECT Title,ContentType,Path FROM SCOPE() WHERE FREETEXT(DefaultProperties,'samochód') AND (CONTAINS(Path,'"/BW/Lists/Pytania Bazy Wiedzy"'))
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top