<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Courier; font-size: 12pt; color: #000000'>This is not the fastest way I'm sure, but it did take 13 seconds. I don't know much about jsword yet, but I'm going to see if I can load entire books at a time, and go through them verse by verse. Bulk loading would likely be much faster.<br><br> Book book = Books.installed().getBook("KJV");<br> if (book == null)<br> {<br> System.exit(1);<br> }<br><br> long before;<br> long after;<br><br> before = System.currentTimeMillis();<br> for (int bookIndex = 1; bookIndex <= 66; bookIndex++)<br> { // all books<br> int maxChapters = BibleInfo.chaptersInBook(bookIndex);<br> for (int chapter = 1; chapter < maxChapters; chapter++)<br> {<br> int maxVerses = BibleInfo.versesInChapter(bookIndex, chapter);<br> for (int verse = 1; verse < maxVerses; verse++)<br> {<br> String bookName = BibleInfo.getBookName(<br> bookIndex).getLongName();<br> Passage versePassage = (Passage) book.getKey(bookName + " " + chapter + ":" + verse);<br> BookData data = new BookData(book, versePassage);<br> String plainText = OSISUtil.getPlainText(data.getOsisFragment());<br> if (plainText.matches(".*wash.*word.*"))<br> {<br> System.out.println(plainText);<br> }<br><br> }<br> }<br>// System.out.println(BibleInfo.getBookName(bookIndex).getLongName());<br> }<br> after = System.currentTimeMillis();<br><br><br>John 13:12So after he had washed their feet, and had taken his garments, and was set down again, he said unto them, Know ye what I have done to you?tag 17 - has no greek word tag 12 "and was set down"<br>Ephesians 5:26That he might sanctify and cleanse it with the washing of water by the word,<br>Revelation of John 7:14And I said unto him, Sir, thou knowest. And he said to me, These are they which came out of great tribulation, and have washed their robes, and made them white in the blood of the Lamb.NOTE! Extra word: "stolei"<br>search took: 13280ms<br><br>----- "trent jsword" <trent.jsword@trentonadams.ca> wrote:
<br>> From: "trent jsword" <trent.jsword@trentonadams.ca><br>> To: "J-Sword Developers Mailing List" <jsword-devel@crosswire.org><br>> Sent: Thursday, February 25, 2010 6:10:41 PM GMT -06:00 US/Canada Central<br>> Subject: Re: [jsword-devel] regex searching<br>><br>> <style>p { margin: 0; }</style><div style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 0);">> Well, I don't know how fast loading verses is in jsword, but my app takes .18 seconds, or possibly a little more depending on what you search for, for searching the entire bible. The bible text is on one verse per line, so there's no need to load one verse at a time. An example of a slow search, which is rare, would be "the.*or", which takes 18.32 seconds because it loads almost the entire bible over the internet, being that LARGE portions of scripture are found, lol)<br>> <br>> Try "blood.*sacrifice" on http://www.trentonadams.ca/biblesearch for an example of a relatively fast search.<br>> <br>> I can't imagine it being a "huge" amount slower with jsword, unless the file types that the data is stored in are particularly slow loading verses. But, jsword seems snappy enough, so I doubt it would be a problem.<br>> <br>> But, if regex was implemented, you could allow the person to specify "within X verses of each other". i.e. "wash" would be in v3 and "word" would be in v4 But it would probably require strange verse concatenations for one attempt, no concatenations for another attempt, shifting one verse at a time through the whole bible, etc, unless you wrote a regular expression parser of your own, that could find certain parts in one verse, and other parts in another. But that gets really complicated. So, on first thought, finding regular expressions between verses would be VERY time consuming. But that's just off the top of my head, so who knows, you might be able to do something fast. ;)<br>> <br>> ----- "Sijo Cherian" <sijo.cherian@gmail.com> wrote:
<br>> > From: "Sijo Cherian" <sijo.cherian@gmail.com><br>> > To: "J-Sword Developers Mailing List" <jsword-devel@crosswire.org><br>> > Sent: Thursday, February 25, 2010 5:46:17 PM GMT -06:00 US/Canada Central<br>> > Subject: Re: [jsword-devel] regex searching<br>> ><br>> > What about finding terms across verse boudaries? As far as I remember the index documents are on per verse basis. So there is no way lucene query can find nearby words in a paragraph (across verse boundaries). Regex can help if we string-together verses or use Passage, but like DM mentioned, it will be slow to run regex (regex can be compiled once, but it has to run on so many verse strings).<div>
<br>> > </div><div>BTW Is anyone working on getting search result highlighting? What needs to done besides using lucene-highlighter during the search?</div><div><br>> > </div><div>-Sijo</div><div><br>> > <div class="gmail_quote">> > On Wed, Feb 24, 2010 at 11:05 PM, DM Smith <span dir="ltr"><<a href="mailto:dmsmith@crosswire.org" target="_blank">dmsmith@crosswire.org</a>></span> wrote:<br>> >
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">JSword search indexes support the full search syntax of Lucene. This has some support for regular expressions. Specifically, it allows for * to mean zero or more characters. I think we've got the Lucene flag to allow prefix wild cards. Note that this is more like what a shell uses: it is not a modifier for the previous character.<br>> >
<br>> >
It was correctly noted that wash.*word will not search the verse as a whole. Lucene search is based on words. The correct pattern in Lucene would be wash*word, as '.' does not mean any character but rather it means a punctuation mark. So "wash.*word" would be split into "wash *word" and would find all verses with the word "wash" and any word ending with "word", such as "sword".<br>> >
<br>> >
The default connector for JSword is OR. It would be good to add the ability for a user to change it to AND. With that, "wash* word" would produce the expected results as it would be interpreted as "wash* AND word" instead of "wash* OR word". (Choice would be some thing like "Search for ALL words instead of ANY words.") We made OR the default because it more closely matched various familiar search engines, such as Google, and because it is the default of Lucene.<br>> >
<br>> >
Lucene does have a regular expression capability, but it is not part of JSword. It would be a good addition. Still, it would be based on words and not on the text of a verse.<br>> >
<br>> >
Adding the ability to search an arbitrary regular expression would be a good addition. I don't think it would be too hard to add it. Jsword already has the interface for any search implementation. Java's Regex is a variant of Perl's but has a bit more power. There are some issues: We'll be adding highlighting to Lucene's search. Adding that to Regex would be a separate effort. The regex search would be mutually exclusive from Lucene search, so that would need to be made obvious. (In The SWORD Project for Windows, they have both it is a bit confusing as it is not clear.)<br>> >
<br>> >
And yes, it will need to go throw the "plain" text of each verse. It will be about as slow as creating an index. Basically, it will need to take the raw verse and strip the markup. (This is part of JSword already and Lucene indexing uses it.) And perhaps strip out the punctuation. Finally doing the search.<br>> >
<br>> >
If you want, add an issue or two to Jira (<a href="http://www.crosswire.org/bugs" target="_blank">www.crosswire.org/bugs</a>) under JSword. That way it won't be forgotten.<br>> >
<br>> >
In Christ,<br>> > <font color="#888888">
DM</font><div><div></div><div class="h5">> > <br>> >
<br>> >
<br>> >
On 02/23/2010 08:33 PM, Trenton D. Adams wrote:<br>> >
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
But then again, I wonder if it's even needed, who knows.<br>> >
<br>> >
----- "Trenton D. Adams"<<a href="mailto:trent.jsword@trentonadams.ca" target="_blank">trent.jsword@trentonadams.ca</a>> wrote:<br>> >
<br>> >
<br>> >
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
From: "Trenton D. Adams"<<a href="mailto:trent.jsword@trentonadams.ca" target="_blank">trent.jsword@trentonadams.ca</a>><br>> >
To: "J-Sword Developers Mailing"<<a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a>><br>> >
Sent: Tuesday, February 23, 2010 7:29:08 PM GMT -06:00 US/Canada Central<br>> >
Subject: [jsword-devel] regex searching<br>> >
<br>> >
Hello,<br>> >
<br>> >
I'm getting the impression that regular expression searching is not at<br>> >
all possible without implementing something that loads the books<br>> >
itself, and goes through each verse of the bible. Is this true?<br>> >
<br>> >
It seems like the Lucene Index just doesn't support regular expression<br>> >
searches, eh? And it also seems like SearcherFactory is currently not<br>> >
finished being implemented as a SearcherFactory, correct? Or, perhaps<br>> >
other methods need to be added, like createSearcher(Book, Class<br>> >
searcherClass)??? Then you could provide another searcher type.<br>> >
<br>> >
What would be appropriate for this? adding the new<br>> >
SearcherFactory.createSearcher(), adding another "find" method to<br>> >
AbstractBook/Book that is something like "find(SearchRequest,<br>> >
Searcher)"???<br>> >
<br>> >
Are the books and everything abstract enough that I can search them by<br>> >
loading the text? Or would I have to restrict it to the book types I<br>> >
know how to parse?<br>> >
<br>> >
Anything else?<br>> >
<br>> >
Thanks.<br>> >
<br>> >
_______________________________________________<br>> >
jsword-devel mailing list<br>> >
<a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br>> >
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>> >
<br>> >
</blockquote>
_______________________________________________<br>> >
jsword-devel mailing list<br>> >
<a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br>> >
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>> >
<br>> >
</blockquote>
<br>> >
<br>> >
_______________________________________________<br>> >
jsword-devel mailing list<br>> >
<a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br>> >
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>> >
</div></div></blockquote></div><br>> > <br clear="all"><br>> > -- <br>> > Regards,<br>> > Sijo<br>> >
</div>
<br>> > _______________________________________________
jsword-devel mailing list
jsword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/jsword-devel
</div><br>> _______________________________________________
jsword-devel mailing list
jsword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/jsword-devel
</div></body></html>