I have tried so many variations and every single one of them returns “Query is not understandable”. Please help.
-
Set dc= db.FTSearch({[Form]=“Document” and [Status]=“Available”},0)
-
Set dc= db.FTSearch({[Form]=“Document” & [Status]=“Available”},0)
-
Set dc= db.FTSearch({FIELD Form=“Document” and FIELD Status=“Available”},0)
-
Set dc= db.FTSearch({(FIELD Form=“Document”) and (FIELD Status=“Available”)},0)
-
Set dc= db.FTSearch({([Form]=“Document”) and ([Status]=“Available”)},0)
Please help!
Thank you in advance.
Subject: RE: Please Help with Db.FTSearch Query
Any of those seem like they should work, but sometimes a query is not understandable because the field datatype differs from the datatype of the value you supplied in the query.
It’s easier to check the query syntax by trying it out in the search box in a view. Try the different parts of the And separately to see which one is the culprit. I wouldn’t expect Form to be other than a test field, so I would suspect Status.
In case the full-text index decided on a certain datatype for a field at an earlier stage when the design was different, you might try deleting and recreating the index. If that doesn’t solve it, write a little agent to go thru all your docs and see whether any have a different datatype for that field.,
Subject: RE: Please Help with Db.FTSearch Query
I did as suggested and it was the Status field that it didn’t like.
Although I am not sure why since I ran this against a view that has Status=“Available” as a selection formula to begin with which means there should not be any Status field value of anything else other than the text value “Available”.
Could it be that “Status” is actually a reserved word? If so, is there a way around this?
Thanks for your help.
Subject: RE: Please Help with Db.FTSearch Query
Status is not a reserved word.
It has nothing to do with what documents are in the view. It has to do with what documents are in the database. Each field name is known to the full-text index and has one datatype associated with it. If you have different datatypes for the same fieldname in different documents, then when you create the full-text index, it will decide the datatype of that fieldname based on the first document it comes across that contains that field.
Fix the problem by renaming the field in one of the forms. Run an agent to update existing documents. Delete the full-text index. Re-create it.
Subject: Please Help with Db.FTSearch Query
One way is
Set dc = db.FTSearch({[Form]=Document & [Status]=Available},0)
In the notes help look for Refining a search query using operators which has all the options that can be used. You can also use the advanced search to define the query and then just copy and paste it into your FTSearch method.
Subject: RE: Please Help with Db.FTSearch Query
Sorry… Thank you but I tried that too… same result. No go.