Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 521
  • Last Modified:

FTSearch does not return the correct document

I have an agent that asks the user to select a document in a list. The list displays the field "Description" of each document available.

After, it peforms an FTSearch to get that document from the same view that was used to build the list.

Say that there are 10 documents to choose from and one of them have the description "Doc 1" and another is "Doc 2". Sometimes when the user selects "Doc 2" it will find the document "Doc 1".

I can't figure out when this happens because somethimes it works correctly and sometimes not.

I tought it was because the user copied "Doc 1" and renamed the copy to "Doc 2". But I tested that and it seems to work.

I also tought it would be because my view was not sorted, so I sorted the description ascending and the error still occured

My view is hidden and contains 2 columns: Description and Structure (In that order)

None of the documents have the same description.

Here is my agent:
Sub Initialize
     Dim View As NotesView
     Dim Template As NotesDocument
     Dim ws As New NotesUIWorkSpace
     Dim s As String
     Dim Session As New NotesSession
     Set db = session.CurrentDatabase
     Set View = db.GetView("vTemplate")    
     
     s = ws.Prompt(PROMPT_OKCANCELLIST,"Choice","Choose a template:",,Evaluate("@DbColumn(''; ''; '(LookupTemplate)'; 1)"))
     If Trim(s) <> "" Then
          s = Chr(34) & s & Chr(34)
          view.FTSearch s,1    
          Set Template = View.GetFirstDocument
          Msgbox Template.Structure(0)
     End If
End Sub

Thanks in advance
0
Pennywisdom
Asked:
Pennywisdom
  • 4
  • 3
1 Solution
 
HemanthaKumarCommented:
Try updating FT index of the database.

Secondly, instead of this line

s = Chr(34) & s & Chr(34)


use this

s = |"| + s + |"|     ' WHich will be equivalent to "s"



~Hemanth
0
 
HemanthaKumarCommented:
also replace 1 with 0 in ftsearch
0
 
PennywisdomAuthor Commented:
Thanks for your reply ~Hemanth.

The help says that NotesDatabase.UpdateFTIndex will create an index only on a local database.

My database is on a server so "db.UpdateFTIndex True" gives me an error.
"db.UpdateFTIndex False" does not give me an error but db.IsFTIndexed still returns false after.
Does this mean that it's not working? Or is it normal?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
HemanthaKumarCommented:
Well it depends on what level of access that you have,you should have atleast designer access to create index.

This can be created manually a one time setup. No need to drive it thru script.

Goto Database..Properties and click on lens icon (Full Text tab), and click on create index.

0
 
zvonkoCommented:
Hello PW,

this note in Help does only concern databases that do NOT have a FT index and a new FT index has to be created.
To verify that "Call db.UpdateFTIndex(False)" is working correctly test this:
1.) Set FT Update Frequency from Immediate to Daly.
2.) Add a document containing a new string combination.
3.) Search in Notes client for this string (should not hit).
4.) Run your agent containing: db.UpdateFTIndex(False)
5.) Search again in Notes client and you will see that FT index was updated.

Regards,
zvonko

0
 
PennywisdomAuthor Commented:
Ok I created the index like Hemantha told me to.

I'll test this and let you know the results has soon as I can.
0
 
PennywisdomAuthor Commented:
Thanks! Seems like indexing did the trick.

Sorry for the delay but I had to make sure it was working since it didn't always bug.
0
 
HemanthaKumarCommented:
Anytime
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now