Re: Printing queries

2002-02-20 Thread Nick Smith

David Elworthy wrote:
 
 When I used toString() on a Query object, I don't get a textual
 representation of the query. Instead I get something like:
   org.apache.lucene.search.BooleanQuery@29
   org.apache.lucene.search.BooleanQuery@14d
 Any ideas what I can do to fix this? BTW, this is with Visual J++.
 
 -- David Elworthy
 

Use Query#toString(String defaultField) instead.

--
Nick Smith

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Dynamic Summary

2002-02-20 Thread Halcsy Pter

Hello,
we implemented an algorithm that makes a summary of fields based on terms in query and 
some parameter (max length, max fragments). 

I hope in 2 days I can send the code (it needs some refactoring, commenting).

peter

 -Original Message-
 From: Sreenivasulu M [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 20, 2002 11:30 AM
 To: 'Lucene Users List'
 Subject: Dynamic Summary
 
 
 Hello All,
   I am using Lucene in a site to search on HTMLs. Can 
 anyone help me
 how to display the summary containing the searched keyword. I 
 think the
 summary is predefined in the Document Object  while creating 
 index. How can
 I dynamically select summary depending on the search keyword? 
 Is there any
 max. limit for the summary length?
 
 Please do respond quickly. Thanks in advance.
 
 regards,
 sreeni
 
 --
 To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Queryparser croaking on [ and ]

2002-02-20 Thread Les Hughes

Hi,

I'm currently building a small app that allows searching of Java sourcecode.
The problem I'm getting is when parsing a query string that contains an
array specifier (ie. String[] or int[][]) the query parser seem to croak
with a

Lexical error at line XX, column XX. Encountered:   after : []


So what am I doing wrong / what should I write to fix this?


Les


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Queryparser croaking on [ and ]

2002-02-20 Thread Biswas, Goutam_Kumar

Les

Parse your query string to remove the charactors '[' , ']' etc. which
are deemed illegal by lucene query-semantics.

-Goutam


-Original Message-
From: Les Hughes [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 20, 2002 4:44 PM
To: '[EMAIL PROTECTED]'
Subject: Queryparser croaking on [ and ]


Hi,

I'm currently building a small app that allows searching of Java sourcecode.
The problem I'm getting is when parsing a query string that contains an
array specifier (ie. String[] or int[][]) the query parser seem to croak
with a

Lexical error at line XX, column XX. Encountered:   after : []


So what am I doing wrong / what should I write to fix this?


Les


--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Phrase problem

2002-02-20 Thread David Elworthy

I'm having a problem search on phrases. If I give the query
 books by Noam Chomsky about politics
then I get a null pointer exception at the point where I issue the
query. I put the above string through QueryParser to get the Query, and
the exception happens on the IndexSearcher search call. The same thing
happens when I use a query I have constructed myself. Printing the query
is fine in either case: it shows
 Text:books Text:noam chomsky Text:about Text:politics 
Also, doing the query without the quotes works properly, so it isn't a
problem with the index or the way I use the query parser.

So far as I can tell, the exception arises in PhraseQuery.scorer, at the
line which says
  TermPositions p = reader.termPositions((Term)terms.elementAt(i));
I'm using lucene 1.2 rc3.

Any ideas?

-- David Elworthy


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Queryparser croaking on [ and ]

2002-02-20 Thread Brian Goetz

This is because the query parser uses [] to denote ranges of numbers.
(I always thought this was a bad choice of syntax for exactly this
reason.)


On Wed, Feb 20, 2002 at 11:14:05AM -, Les Hughes wrote:
 Hi,
 
 I'm currently building a small app that allows searching of Java sourcecode.
 The problem I'm getting is when parsing a query string that contains an
 array specifier (ie. String[] or int[][]) the query parser seem to croak
 with a
 
 Lexical error at line XX, column XX. Encountered:   after : []
 
 
 So what am I doing wrong / what should I write to fix this?
 
 
 Les
 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Queryparser croaking on [ and ]

2002-02-20 Thread Scott Ganyo

Actually, [] denotes an inclusive range of Terms.  Anyway, why not change
the syntax if this is bad...?

Scott

 -Original Message-
 From: Brian Goetz [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 20, 2002 10:08 AM
 To: Lucene Users List
 Subject: Re: Queryparser croaking on [ and ]
 
 
 This is because the query parser uses [] to denote ranges of numbers.
 (I always thought this was a bad choice of syntax for exactly this
 reason.)
 
 
 On Wed, Feb 20, 2002 at 11:14:05AM -, Les Hughes wrote:
  Hi,
  
  I'm currently building a small app that allows searching of 
 Java sourcecode.
  The problem I'm getting is when parsing a query string that 
 contains an
  array specifier (ie. String[] or int[][]) the query parser 
 seem to croak
  with a
  
  Lexical error at line XX, column XX. Encountered:   after : []
  
  
  So what am I doing wrong / what should I write to fix this?
  
  
  Les
  
  
  --
  To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
  For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 
 --
 To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 



Indexing Dynamically Generated Web Pages

2002-02-20 Thread Paul Friedman

Hello Lucene Users,

I am a novice developer researching Lucene for use on a web site that
primarily uses JSPs.

How do you index dynamically generated web pages with Lucene?
Or is it even possible?

The JSPs themselves don't have searchable data, only methods to get that
data.
When parsing these files for indexing, the necessary data for the search
would not yet be in the page.
The data upon which to search is generated only after certain parameters are
passed to the JSP ( resulting in the HTML output ).

Thanks in advance.

pax et bonum. p.


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Indexing Dynamically Generated Web Pages

2002-02-20 Thread Steven J. Owens

Paul Friedman [EMAIL PROTECTED] asks:
 I am a novice developer researching Lucene for use on a web site
 that primarily uses JSPs.  How do you index dynamically generated
 web pages with Lucene?  Or is it even possible?
 The JSPs themselves don't have searchable data, only methods to get
 that data.  When parsing these files for indexing, the necessary
 data for the search would not yet be in the page.

 Lucene doesn't do any crawling for you - it's your responsibility
to write the code that crawls your website, i.e. selects the data
sources to be indexed, chooses how to convert them to Lucene
Documents, and adds them to the indexes.  I suspect you're assuming
you would use the demo application.  That would not be appropriate for
your project.

 Instead, what you should do is:

1) write some java code that walks through your data source - i.e. if
your data source is a database, it would select each row in the
appropriate table - and composes a Lucene Document, and adds it to
your index.

2) write some servlets/jsps that do the search, and when it gets to
the point where you would redirect the user's browser off to the
appropriate HTML page, you either:

 a) invoke the appropriate JSP in your site with appropriate
arguments

 or

 b) compose a page dynamically, roughly the same way the JSP page
would compose it, and return it to the user.

 or

 c) redirect the user to a new JSP page, which you will have to
write, which looks much like your old JSP page, but is
designed to be invoked with an argument specifying what
data to load.

 You may find http://darksleep.com/puff/lucene/lucene.html useful
in further clarifying this.  There is also a getting started article
at http://jakarta.apache.org/lucene/docs/index.html that may be of
some use.

Steven J. Owens
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




JSP Parser class wanted

2002-02-20 Thread w i l l i a m__b o y d

Please, does anyone have a JSPParser class that parses JSPs?

I hacked the HTMLParser class that comes in the Lucene demo and made it parse and 
index JSPs. But when i would do a search, the jsp tags 

 %pageContext.setAttribute( req, request );% 
%@ page import=com.propelnewmedia.tags.BreadcrumbTrailer%


and so on, were included in the summary. 
Then, I figured out a way to get the JSP tags out of the summary (and i think out of 
the index as well). 

What I did was designate JSP tags (anything starting with % and ending with %) as a 
3rd comment type in the void CommentTag() :, TOKEN :, and WithinCommentN TOKEN : 
sections of HTMLParser.jj 

I just copied and pasted the relevant code for Comment2 and mimicked that for my new 
Comment type. I then recompiled HTMLParser.jj using javacc. 

I'm still not out of the woods though. I still need to know how to make Lucene not 
include list element values, etc in the search hits. For instance, if a keyword 
happens to be in a selection list, it gets counted as a hit. 

Any suggestions (or preferably, working code) would be massively appreciated!. Thanks 
in advance.