I have a small script that searches zip codes that fall within a
certain range. The results are returned as a query. The cfsearch tag
looks like this

<CFSEARCH NAME="Search" COLLECTION="#category" type="simple"
criteria="#criteria_string#">

The #criteria string# is created by a loop which adds 'OR
custom3:#zipcode#' too the criteria_string as it loops through all of
the matching zip codes. What I end up with is something like the
following as the criteria_string

'keywords keywords keywords AND (custom3:46135 OR custom3:46135 OR
custom3:46170 OR custom3:46171 OR custom3:46175 OR custom3:46349 OR
custom3:46381 OR custom3:47427 OR custom3:47438)

This works fine. My only other choice was to do a search on all
listings that matched according to keywords only, then dump that to
another query to search for matching zip codes. I figured that was
very very inefficient since a keyword search could result in thousands
of records returned only to have a few actually match accorind to zip
code. So I figured it best to search according to zip code match from
the get go.

What I'm finding though, is that if I do a wide range search on a zip
code, say all zips within 150 miles, it returns thousands of zips. I
end up with a string like the following, except it has about 2,000 OR
boolean clauses and presents a very long string.

'keywords keywords keywords AND (custom3:46135 OR custom3:46135 OR
custom3:46170 OR custom3:46171 OR custom3:46175 OR custom3:46349 OR
custom3:46381 OR custom3:47427 OR custom3:47438)

Apparently, the ceiling for boolean clauses in lucene 1024. I found a
similar problem discussed at the following link.
http://stackoverflow.com/questions/8532/with-lucene-why-do-i-get-a-too-many-clauses-error-if-i-do-a-prefix-search

The last post mentiones "If more than 1024 (by default) match, the
TooManyClauses-Exception is thrown. You can call
BooleanQuery.setMaxClauseCount to increase the maximum number of
clauses permitted per BooleanQuery"

1. How can I change that limit via OpenBD? I know nothing about lucene
other than how to access it via OpenBD. When/where would I run that
statement to increase the maxClauseCount?

2. Should I even change that? I was thinking I create a loop that
would do the cfsearch in batches, doing about 1,000 matches per query,
then combining the queries at the end. So if I have to, do several
<CFSEARCH> statements and dump them to a new query that would be used
to assemble the results. This way, if the first of a few batches
itself returns a huge amount of results, I could break out of that
loop, and tell the user (search results returned more than 500
matches, please refine your search to see more matches).





-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 mailing list - http://groups.google.com/group/openbd?hl=en

 !! save a network - please trim replies before posting !!

Reply via email to