lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Don Hill <dhill.nov...@gmail.com>
Subject Re: How to query a lucene index from JavaScript (no server or jvm)?
Date Wed, 14 Nov 2012 23:28:23 GMT
You would still need a jvm but you could use rhino to interface javascript with java classes.
Then use a lucene in memory index. 
On Nov 14, 2012, at 4:45 PM, Joseph Lewis wrote:

> If you're just looking for something that is that small of a scale, and on
> that small of a set of input files, you might to think about just writing
> some kind of script (using something like beautiful soup to extract the
> text from pages), that would then create a Lucene-like index, meaning your
> script could look at some kind of table for the word the user input, and
> get a list of documents back that had that list.
> 
> In JSON it might look something like this:
> 
> {
>   "word1":["http://example.com/page1","http://example.com/page54"],
>   "word2":["http://example.com/page54"],
>   ...
> }
> 
> This would have the benefit of the format already being parsable through
> Javascript, although you'd probably want to cut down the size of the URLs
> you kept by storing them in their own object with some kind of primary key.
> 
> If, for some other reason, you wanted to use Lucene, I believe the
> "simpletext" codec will save the Lucene index in something that would be
> easier for you to work with:
> http://lucene.apache.org/core/4_0_0/codecs/org/apache/lucene/codecs/simpletext/package-summary.html
> 
> This is a newly introduced feature to 4.0 if I remember correctly, meant as
> a debugging feature.
> 
> 
> - Joseph | http://josephlewis.net
> 
> 
> On Wed, Nov 14, 2012 at 8:38 AM, Carlos de Luna Saenz <
> cdelunasaenz@yahoo.com.mx> wrote:
> 
>> JavaFX is your friend and WebView is the ally
>> 
>> 
>> 
>> 
>> 
>>> ________________________________
>>> De: Paul Jungwirth <pj@illuminatedcomputing.com>
>>> Para: general@lucene.apache.org
>>> Enviado: Martes, 13 de noviembre, 2012 5:59 P.M.
>>> Asunto: Re: How to query a lucene index from JavaScript (no server or
>> jvm)?
>>> 
>>>> I have been asked to "develop a HTML page with a Search textbox to
>> search
>>> a
>>> collection of HTML files without using a Server"
>>> 
>>> That sounds very tricky! This is client-side Javascript, right? I don't
>>> know how JS running in someone's web browser could access your Lucene
>> index
>>> without a server making it available. If you want an easy server solution,
>>> Solr and ElasticSearch are both good options that expose Lucene to remote
>>> clients, with web-based APIs you could call directly from client-side
>>> Javascript. Or you could send the JS calls to whatever you're using to
>>> serve the HTML pages, and have that use Lucene/Solr/ES/etc. behind the
>>> scenes.
>>> 
>>> Good luck,
>>> Paul
>>> 
>>> 
>>> On Fri, Nov 9, 2012 at 6:23 AM, dcgoodwin <dennis.goodwin@sas.com> wrote:
>>> 
>>>> I have been asked to "develop a HTML page with a Search textbox to
>> search a
>>>> collection of HTML files without using a Server". Lets say the number of
>>>> HTML files are less than 500 and the file size is less than .5 Mbyte.
>>>> 
>>>> I am creating a Lucene index from the set of HTML files from Java when I
>>>> generate the HTML files from XML source files. I am not seeing how to
>> query
>>>> the Lucene index from JavaScript only (no server of jvm). I am thinking
>> I
>>>> need to create 1 or more XML files from the Lucene index and use
>> JavaScript
>>>> to load-up the XML files to perform a search.
>>>> 
>>>> Please let me know if this sounds reasonable given the constraints and
>> if
>>>> folks have tried this before.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> View this message in context:
>>>> 
>> http://lucene.472066.n3.nabble.com/How-to-query-a-lucene-index-from-JavaScript-no-server-or-jvm-tp4019318.html
>>>> Sent from the Lucene - General mailing list archive at Nabble.com.
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> _________________________________
>>> Pulchritudo splendor veritatis.
>>> 
>>> 
>>> 
>> 


Mime
View raw message