Subject Re: Max length of SQL statement
Author Stephen Boyd
> >I don't want to return more than 1500 keywords but it is
conceivable
> >that I could get more than 1500 hits for a single keyword.
>
> That's not the right answer. Could you review the question and
> answer that question? I want to understand what your "fuzzy
search"
> is actually supposed to achieve. Otherwise, I give up.

Sorry, misread the question. It happens sometimes.

I do not want to provide in excess of 1500 keywords to a single
query. I only want to provide a handful of keywords to the query.
Where I am running into a problem is in the way I am retrieving the
documents matching those keywords. I search the keyword table for
each keyword entered by the user to get the list of matching document
numbers for that keyword. I then build a bitmap of matching document
numbers for each keyword and AND and OR the bitmaps together to get
the ultimate list of matching document ids. I then use SELECT IN
with the list of matching document ids to return the documents
themselves. If I get more that 1500 matching doucments I am running
into the limit on the IN clause.

I have tried various methods to join the keyword table result sets
with the document table but I can't find a way that gives the desired
result in a reasonable length of time.