[jsword-devel] Searching with headings
DM Smith
dmsmith at crosswire.org
Wed Aug 15 12:52:02 MST 2012
It doesn't allow leading wildcards.
In more recent versions of Lucene it is possible to turn on the capability. But there are dire warnings about it and that it is not a good idea.
On Aug 15, 2012, at 3:34 PM, "Troy A. Griffitts" <scribe at crosswire.org> wrote:
> I also don't believe lucene allows * prefixes on words-- only postfix. Have you tried simply:
>
> heading:water
>
>
>
> On 08/15/2012 09:30 PM, Martin Denham wrote:
>> I think there might be a problem with index creation code or .conf files. Comparing the Strongs index creation code (which works) with Headings:
>>
>> In LuceneIndex you see:
>> boolean hasStrongs = book.getBookMetaData().hasFeature(FeatureType.STRONGS_NUMBERS);
>> boolean hasHeadings = book.getBookMetaData().hasFeature(FeatureType.HEADINGS);
>>
>> Then in kjv.conf you see various attributes relating to Strongs and Headings but I believe the 3rd one is the one used by the above code in LuceneIndex::
>> GlobalOptionFilter=OSISStrongs
>> GlobalOptionFilter=OSISHeadings
>> Feature=StrongsNumbers
>>
>> However, in a module that contains headings like ESV in esv.conf there is no
>> Feature=Headings
>>
>> So it may be that the headings do not make it into the index because of the following in LuceneIndex:
>> if (hasHeadings) {
>> addField(doc, headingField, OSISUtil.getHeadings(osis));
>> }
>>
>> but DM will be able to confirm if that is the problem.
>>
>> Martin
>>
>> On 15 August 2012 20:06, Chris Burrell <chris at burrell.me.uk> wrote:
>> Hi all
>>
>> I'm trying to search the headings of a particular book (say ESV).
>>
>> I'm using the following query "heading:*water*" which I was hoping should match "Jesus walks on Water" (case doesn't seem to make a difference).
>>
>> My code is simply: bible.find(new DefaultSearchRequest(query, modifier));
>>
>> Has anyone else managed to get this working?
>>
>> Chris
>>
>>
>>
>> final long start = System.currentTimeMillis();
>>
>> final DefaultSearchModifier modifier = new DefaultSearchModifier();
>> modifier.setRanked(ranked);
>> modifier.setMaxResults(MAX_RESULTS);
>>
>> final Book bible = this.av11nService.getBookFromVersion(version);
>>
>> try {
>>
>> final Key results;
>>
>> // TODO JS-228 raised for thread-safety
>> synchronized (this) {
>> results = bible.find(new DefaultSearchRequest(query, modifier));
>> }
>>
>> LOGGER.debug("[{}] verses found.", results.getCardinality());
>>
>> if (ranked) {
>> rankAndTrimResults(results, MAX_RESULTS);
>> } else {
>> trimResults(results, MAX_RESULTS);
>> }
>> LOGGER.debug("Trimmed down to [{}].", results.getCardinality());
>>
>> final long startRefs = System.currentTimeMillis();
>> final List<SearchEntry> resultPassages = getPassagesForResults(bible, results);
>> final long endRefs = System.currentTimeMillis();
>>
>> return getSearchResult(query, start, startRefs, endRefs, resultPassages);
>> } catch (final BookException e) {
>> throw new StepInternalException("Unable to search for " + query + " with Bible " + version, e);
>> }
>>
>> _______________________________________________
>> jsword-devel mailing list
>> jsword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>
>>
>>
>>
>> _______________________________________________
>> jsword-devel mailing list
>> jsword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20120815/064a0af9/attachment.html>
More information about the jsword-devel
mailing list