问题
A client have a long lived IBM Notes application where someone along the line changed the type of a field from number to text.
So, now when we're trying to do an FT search like: [myField] = "1234" receive the error message: "Query is not understandable".
If I do: [myField] = 1234 it works but won't return any hits. Even though there's a document where myField = "1234".
The field is of type text in the design.
I've created a new view for testing, only allowing documents from one form.
Deleted the full text index (even on the file system) updall -X Fixup -r Created full text index
In my test view I've got one column that shows if the field content being searched is of type text @IsText(myField) and all rows shows: 1 (so it's field content must be text)
None of the above worked so I created a new database copy locally. Same problem.
Created an entirely new database (for testing only), form, view and full text index and that works.
Feels like the existing database design somewhere stores the old field type...
Any ideas appreciated.
Thanks!
/J
回答1:
Datatypes and field names are stored in the UNK table. There is just one entry per field name, so it's critical not to use the same field name more than once in an application with different datatypes.
You need to rebuild the UNK table, as I blogged here http://www.intec.co.uk/full-text-search-musings/
Note, it must be an offline compact, as Duffbert says here http://www.duffbert.com/duffbert/blog.nsf/d6plinks/TDUF-5SMHV4. If anyone is in the database when you do the compact, it will fail and the UNK table will not be rebuilt.
回答2:
Links are useful, but if you don't want to remove data from documents - for me such steps worked (and there was no need in removing fields from forms in designer):
Run from designer with manager access with such code inside
Sub Initialize Dim s As New NotesSession Dim db As NotesDatabase Dim dc As NotesDocumentCollection Dim doc As NotesDocument Dim i As Integer Dim nc As NotesNoteCollection Dim noteid As String Dim nextnoteid As string Dim itemArr As Variant Dim NeedSave As Boolean Const ITEM_NAME = "itemName1|itemName2" itemArr = Split( ITEM_NAME, "|" ) 'погромист-кун не должен забывать про наличие итемов в формах... Set db = s.Currentdatabase Set nc = db.CreateNoteCollection(False) nc.SelectForms = true Call nc.BuildCollection noteid = nc.Getfirstnoteid() For i = 1 To nc.Count Set doc = db.Getdocumentbyid( noteid ) noteid = nc.Getnextnoteid( noteid ) NeedSave = false ForAll IA In itemArr If doc.Hasitem( IA ) Then Call doc.Removeitem( IA ) NeedSave = true End If End ForAll If NeedSave Then Call doc.Save( True, False ) End If Print CStr( i ) & "\" & CStr( nc.Count ) Next End Sub
Remove database index
- Run from administrator command lo compact database.nsf -c , like mentioned in links above
- Create index
来源:https://stackoverflow.com/questions/17087281/query-is-not-understandable-full-text-searching-where-field-types-have-chang