gkidd
gkidd

Reputation: 199

How to use wild cards in FT search

I have the following:

tmpArray[cTerms++] = "[sclenka] CONTAINS \"*" + sessionScope.sclenka +"*\"";

(With the help of Per Henrik Lausten)

Which should result in: "*term*" But it doesn't, I get this instead: "term"

So, my question is how do I use wildcard full text search?

Thank you!

Upvotes: 0

Views: 2386

Answers (6)

Andrew Pollack
Andrew Pollack

Reputation: 140

@GKIDD

I just tested this on my own site. I have NCTSearch setup. I accepts the search term from the the web and runs database.ftsearch() as part of its job from within lotuscript.

I searched on "data*" and got at least as many results as when I searched on "database".

Based on that, I think something else is going on.

From my earlier comment on other answer, try this: Create another agent that does JUST the search. Have it grab the search term from agent context as if it were a docid. Call the agent from the first agent using "agent.runonserver(searchterm)" see if you can fool it

Andrew, I'm getting the results with Anonymous user, but not with the wildcard. Here goo.gl/YVtXm on the first line, it says that CONTAINS or contains or = does not work when searching from the web.

Upvotes: 0

Andrew Pollack
Andrew Pollack

Reputation: 140

leyrer, is it possible -- just possible -- that you're doing this in a browser and your session is not authenticated? If so, you may be searching the database as "anonymous" where when you test from the browser you're searching as "leyrer".

It's just a thought - but I used to see that all the time when people would start using my NCT Search tools. They'd swear they were getting no results, and when I'd dig I'd always find that they were using the browser as anonymous rather than as a logged in session.

Upvotes: 0

jjtbsomhorst
jjtbsomhorst

Reputation: 1667

I think you have missed a bit of escaping characters in the String you are generating.

tmpArray[cTerms++] = "[sclenka] CONTAINS \"" + sessionScope.sclenka +"\"";

Upvotes: 0

Simon O'Doherty
Simon O'Doherty

Reputation: 9359

If your string is correct and you are getting no results, then test the same string in the Notes client FTI search.

You can also use the following debug on the server.

DEBUG_FTV_SEARCH=1

Then check the output on the domino console when you do a search.

Upvotes: 1

Per Henrik Lausten
Per Henrik Lausten

Reputation: 21709

If you want to use a wildcard search, then generate the following query string:

tmpArray[cTerms++] = "[sclenka] = \"*" + sessionScope.sclenka +"*\"";

This should generate a search on "*search query*".

In general, this is a good way of performing a search since the user probably expect your search to work like that.

Source: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Searching_for_Documents#Full-text+Search

Upvotes: 1

Andrew Pollack
Andrew Pollack

Reputation: 140

So if I understand you, the result is an escaped form of the search term in which the asterisks have been removed?

Could you use the construct:

tmpArray[cTerms++] = "[sclenka] CONTAINS \"" + String.fromCharCode(42) + sessionScope.sclenka + String.fromCharCode(42) + "\"";

At least that should avoid escaping?

Upvotes: 0

Related Questions