Lorenzo Campedelli <[EMAIL PROTECTED]> wrote:
> I just read this thread. I can confirm that the problem noticed by
> Arthur exists in my setup, 3.2.0b2.
>
> The problem is that if you look for XXX and YYY, XXX has matches
> in some documents, while YYY has NO matches in ANY document in the
> database, the rearch will result in the same result as a search for XXX
> alone.
>
> I think I found the "guilty" code at line 353 of htsearch/parser.cc
[...]
> I'd like to try a patch for this, but the parser code is not so
> clear to me
> and I fear to have side effects by changing it.
> Any ideas ?
Well, removing the "->isIgnore = 1" line seemed to do the trick - that way,
the empty list seems to be _skipped_ correctly by score().
Also, I think I found the logic that was causing my odd phrase searches (if,
with XXX and YYY as above, you search for "YYY XXX", the search gives you
the result for "XXX', ignoring YYY): at line 290 of parser.cc: (function
perform_phrase())
// If we don't have a prior list of words, we want this one...
if (oldWords.Count() == 0)
{
newWords->Start_Get();
while ((newWord = (HtWordReference *) newWords->Get_Next()))
oldWords.Add(newWord);
return;
}
Putting these two together, I came up with the following diff in
htsearch/parser.cc. Geoff, I think you said that the parser needs a
rewrite, so my patch/hack may be of limited utility. But for now at least,
it seems to give accurate AND and phrase matches, and gets rid of an
infinite loop I stumbled across when you feed htsearch a phrase without a
closing ".
FWIW,
arthur.
[below is for htsearch/parser.cc, diffs from the 3.2.0b2 copy]
173a174
> int skipRest = 0;
186,188c187,194
< if (output)
< perform_phrase(*wordList);
<
---
> if (output && !skipRest)
> {
> perform_phrase(*wordList);
> if (wordList->Count() == 0)
> // just the start of the phrase has no results => skipRest
> skipRest = 1;
> }
>
190a197,201
> else if (lookahead == DONE)
> {
> setError("'\"'");
> break;
> }
355,356c366,367
< // We can't score an empty list, so this should be ignored...
< list->isIgnore = 1;
---
> // We can't score an empty list, so stop here
> // (setting isIgnore as well would cause errors with AND)
------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED]
You will receive a message to confirm this.