I'm working on a writing my own searchengine pages for my site.
However, I'm having a problem with the Indexing Server part of the ASP
script.
I haven't been using SQL format for querying the catalog, because I
basically lacked the documentation to do it properly that way. I've
used a script which I found and used it as a start. The amount of
documentation and proper to-the-point useful examples for such search
engine are not easy to find.
The Problem (emphasizing) is as follows: the more keywords I enter,
the more results I get. From this I conclude that it's basically an OR
query. But best is naturally an AND query, to refine the search. By
AND I _don't_ mean exact phrase. I just need results in which possibly
all given keywords appear, no matter what location in that particular
document or what order of the keywords.
I've tried @contents <keywords>, but this results in an exact phrase
situation and is very inconvenient. It just has to look for ALL
keywords instead of ANY keywords. No idea how that is achieved with
the format below.
I've tried to allow a user to use e.g. and, not and and such:
- "keyword1 and keyword2 and keyword3" would end up in "query contains
only ignored words. If I specify "keyword1 keyword2 keyword3" I would
get results tho with these three keywords and those keywords are
surely not ignored words. Also I use the Dutch noise dictionary.
- "keyword4 and keyword5" did work for me, but in this case it were
results with those words glued to eachother, kinda like @contents,
exact phrase.
With SQL format I think it would be done with LIKE %keyword1% AND LIKE
%keyword2% AND LIKE %keyword3%, but I'm too inexperienced to convert
the stuff below to a working version of that I'd have no idea e.g.
how it's done with the #vpath stuff. Would I query "intranet" like it
were a table? I'm at a loss here beginning till end.
Basically what I need is a working example for an ALL keywords (with
order of keywords not being importnant) search, but not exact phrase.
I hope someone can help me out.
Finally, the script works fine for EXACT keyword phrase searches, and
OR keyword searches - it is just the AND keyword searches that are
driving me crazy!
*** UPDATE *** I withdrew the question, as the script suddenly seemed
to start working, but now it seems to have stoped working and the code
has not changed - this only adds to my confusion!?!?!
Part of the ASP script in shown below:
==============================================================================
Set objQuery = Server.CreateObject("ixsso.query")
Set objUtil = Server.CreateObject("ixsso.util")
my_keyword=replace(trim(request("keyword")),"'","''")
my_option=replace(trim(request("ws4uopt")),"'","''")
if my_option="EXACT" then
my_keyword2="""" & my_keyword & """"
else if my_option="ALL" then
my_keyword2=replace(my_keyword," "," AND ")
else if my_option="ANY" then
my_keyword2=replace(my_keyword," "," OR ")
end if
end if
end if
myQuery=my_keyword2
response.write "My Keyword [" & my_keyword2 & "]<br>"
response.write "My Query [" & myQuery & "]<br>"
response.write "Keywords [" & request("keyword") & "]<br><br>"
objQuery.Query=myQuery
objQuery.Columns = "Path, Vpath, DocTitle, Filename, Characterization,
Contents,DocKeyWords, Rank"
objQuery.SortBy = "Rank [d]"
objQuery.MaxRecords = 25
objquery.catalog="xxxxxxxxx.xx.xx"
objquery.LocaleID = objutil.ISOToLocaleID("EN-US")
objUtil.AddScopeToQuery objQuery, "/StaticPages", "deep"
Set rstemp = objQuery.CreateRecordSet("nonsequential")
==============================================================================
thanks
Jamie |