Re: Lucene Error : java.io.FileNotFoundException

2008-07-04 Thread Michael McCandless


Are you getting exactly the same error (same source files and exact  
same line numbers)?  If so, somehow a Lucene 1.4 JAR is still sneaking  
in.


Lucene 1.4 won't be able to read an index created by Lucene 2.3.   
You'll see exactly that FileNotFoundException because newer versions  
of Lucene write to a segments_N file, while 1.4 tries to open just the  
file "segments".


Mike

yugana wrote:



I have checked all the jars and tried replacing with the same  
versions. Still

I get the same error. Please let me know what else to check.

yug


Michael McCandless-2 wrote:



It looks like under JBoss you are accidentally using Lucene 1.4, not
2.3.2.

Mike

yugana wrote:



Hi,

I am indexing content and searching using lucene. It is working fine
when I
use the simple servlet and jsp mechanism. I am able to search on the
indexed
content. I tried to implement the same using JBoss Portal. When I
try to run
the search, I get the below error: Please help me to resolve the
error. I am
using Lucene 2.3.2

09:43:42,671 ERROR [STDERR] java.io.FileNotFoundException:
D:\indexDir\segments (The system cannot find the file specified)
09:43:42,671 ERROR [STDERR] at
java.io.RandomAccessFile.open(Native
Method)
09:43:42,671 ERROR [STDERR] at
java.io.RandomAccessFile.(RandomAccessFile.java:212)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.store.FSInputStream
$Descriptor.(FSDirectory.java:376)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.store.FSInputStream.(FSDirectory.java:405)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.store.FSDirectory.openFile(FSDirectory.java:268)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:40)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.index.IndexReader$1.doBody(IndexReader.java:116)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.store.Lock$With.run(Lock.java:109)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.index.IndexReader.open(IndexReader.java:111)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.index.IndexReader.open(IndexReader.java:95)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.search.IndexSearcher.(IndexSearcher.java:38)
09:43:42,671 ERROR [STDERR] at
com.xerox.mywebboard.search.SearchManager.search(SearchManager.java:
53)
09:43:42,671 ERROR [STDERR] at
com
.xerox
.mywebboard
.xeroxArticleSearchPortlet.search(xeroxArticleSearchPortlet.java:45)
09:43:42,671 ERROR [STDERR] at
com
.xerox
.mywebboard
.xeroxArticleSearchPortlet
.processAction(xeroxArticleSearchPortlet.java:27)
09:43:42,671 ERROR [STDERR] at
org
.jboss
.portal
.portlet
.impl
.jsr168.PortletContainerImpl.invokeAction(PortletContainerImpl.java
09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal
.portlet
.impl 
.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:

401
09:43:42,687 ERROR [STDERR] at
org.jboss.portal.portlet.container.PortletContainerInvoker
$1.invoke(PortletContainerInvoker.java
09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal.common.invocation.Invocation.invokeNext(Invocation.java:131)
09:43:42,687 ERROR [STDERR] at
org.jboss.portal.core.aspects.portlet.TransactionInterceptor.org
$jboss$portal$core$aspects$portl
09:43:42,687 ERROR [STDERR] at
org.jboss.portal.core.aspects.portlet.TransactionInterceptor
$invokeNotSupported_N454727078796479
09:43:42,687 ERROR [STDERR] at
org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
09:43:42,687 ERROR [STDERR] at
org.jboss.aspects.tx.TxInterceptor
$NotSupported.invoke(TxInterceptor.java:112)
09:43:42,687 ERROR [STDERR] at
org.jboss.portal.core.aspects.portlet.TransactionInterceptor
$invokeNotSupported_N454727078796479
09:43:42,687 ERROR [STDERR] at
org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
09:43:42,687 ERROR [STDERR] at
org.jboss.aspects.tx.TxInterceptor
$NotSupported.invoke(TxInterceptor.java:102)
09:43:42,687 ERROR [STDERR] at
org.jboss.portal.core.aspects.portlet.TransactionInterceptor
$invokeNotSupported_N454727078796479
09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal
.core
.aspects
.portlet.TransactionInterceptor.invokeNotSupported(TransactionInter
09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal
.core
.aspects
.portlet.TransactionInterceptor.invoke(TransactionInterceptor.java:
09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal
.portlet
.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38)
09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)
09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal
.core
.aspects.portlet.HeaderInterceptor.invoke(HeaderInterceptor.java:50)
09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal
.portlet
.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38)
09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)
09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal
.portlet

Re: Sorting case-insensitively

2008-07-04 Thread Paul J . Lucas

On Jun 30, 2008, at 8:08 PM, Paul J. Lucas wrote:


On Jun 30, 2008, at 8:55 PM, Paul J. Lucas wrote:
If I have a SortField with a type of STRING, is there any way to  
sort in a case-insensitive manner?


Couldn't I also use a custom SortComparator?


OK, so I tried that by doing:

SortField sortField = new SortField(
sortFieldName,
new CaseInsensitiveStringSortComparator(), descending
);

where CaseInsensitiveStringSortComparator is:

class CaseInsensitiveStringSortComparator extends SortComparator {
public Comparable getComparable( String termText ) {
return new CaseInsensitiveStringComparable( termText );
}
}

and CaseInsensitiveStringComparable is:

public class CaseInsensitiveStringComparable implements Comparable {

public CaseInsensitiveStringComparable( String s ) {
m_string = s.toLowerCase();
}

public int compareTo( Object o ) {
final String s;
if ( o instanceof CaseInsensitiveStringComparable )
s = ((CaseInsensitiveStringComparable)o).m_string;
else if ( o instanceof String )
s = ((String)o).toLowerCase();
else
throw new ClassCastException();
return m_string.compareTo( s );
}

public boolean equals( Object o ) {
if ( !(o instanceof CaseInsensitiveStringComparable ) )
return false;
final CaseInsensitiveStringComparable c =
(CaseInsensitiveStringComparable)o;
return m_string.equals( c.m_string );
}

public int hashCode() {
return m_string.hashCode();
}

private final String m_string;
}

But when my code runs, I get a NullPointerException in Lucene's  
SortComparator,

line 54 which reads:

return cachedValues[i.doc].compareTo (cachedValues[j.doc]);

because cachedCalues[i.doc] is null.  But why is it null?

- Paul

P.S.: Im using Lucene 2.3.2.

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



Re: Lucene Error : java.io.FileNotFoundException

2008-07-04 Thread yugana

I see a JAR file at
D:\jboss-portal-2.6.5.GA\server\default\deploy\jboss-portal.sar\portal-cms.sar\lib
. when I tried to replace this JAR with the new JAR file, I get the
following errors while restarting the JBoss server.

11:50:10,046 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

--- MBeans waiting for other MBeans ---
ObjectName: portal:service=CMS
  State: FAILED
  Reason: java.lang.AbstractMethodError:
org.apache.lucene.store.Directory.openInput(Ljava/lang/String;)Lorg/apache/lucene/store/IndexInput;
  I Depend On:
jboss.jca:service=DataSourceBinding,name=PortalDS
portal:service=JAASLoginModule
portal:service=Hibernate,type=CMS
cms.pm.cache:service=TreeCache
portal:service=AuthorizationManager,type=cms
portal:service=InterceptorStackFactory,type=Cms
  Depends On Me:
portal:commandFactory=CMSObject

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: portal:service=CMS
  State: FAILED
  Reason: java.lang.AbstractMethodError:
org.apache.lucene.store.Directory.openInput(Ljava/lang/String;)Lorg/apache/lucene/store/IndexInput;
  I Depend On:
jboss.jca:service=DataSourceBinding,name=PortalDS
portal:service=JAASLoginModule
portal:service=Hibernate,type=CMS
cms.pm.cache:service=TreeCache
portal:service=AuthorizationManager,type=cms
portal:service=InterceptorStackFactory,type=Cms
  Depends On Me:
portal:commandFactory=CMSObject




Michael McCandless-2 wrote:
> 
> 
> Are you getting exactly the same error (same source files and exact  
> same line numbers)?  If so, somehow a Lucene 1.4 JAR is still sneaking  
> in.
> 
> Lucene 1.4 won't be able to read an index created by Lucene 2.3.   
> You'll see exactly that FileNotFoundException because newer versions  
> of Lucene write to a segments_N file, while 1.4 tries to open just the  
> file "segments".
> 
> Mike
> 
> yugana wrote:
> 
>>
>> I have checked all the jars and tried replacing with the same  
>> versions. Still
>> I get the same error. Please let me know what else to check.
>>
>> yug
>>
>>
>> Michael McCandless-2 wrote:
>>>
>>>
>>> It looks like under JBoss you are accidentally using Lucene 1.4, not
>>> 2.3.2.
>>>
>>> Mike
>>>
>>> yugana wrote:
>>>

 Hi,

 I am indexing content and searching using lucene. It is working fine
 when I
 use the simple servlet and jsp mechanism. I am able to search on the
 indexed
 content. I tried to implement the same using JBoss Portal. When I
 try to run
 the search, I get the below error: Please help me to resolve the
 error. I am
 using Lucene 2.3.2

 09:43:42,671 ERROR [STDERR] java.io.FileNotFoundException:
 D:\indexDir\segments (The system cannot find the file specified)
 09:43:42,671 ERROR [STDERR] at
 java.io.RandomAccessFile.open(Native
 Method)
 09:43:42,671 ERROR [STDERR] at
 java.io.RandomAccessFile.(RandomAccessFile.java:212)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.store.FSInputStream
 $Descriptor.(FSDirectory.java:376)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.store.FSInputStream.(FSDirectory.java:405)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.store.FSDirectory.openFile(FSDirectory.java:268)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:40)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.index.IndexReader$1.doBody(IndexReader.java:116)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.store.Lock$With.run(Lock.java:109)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.index.IndexReader.open(IndexReader.java:111)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.index.IndexReader.open(IndexReader.java:95)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.search.IndexSearcher.(IndexSearcher.java:38)
 09:43:42,671 ERROR [STDERR] at
 com.xerox.mywebboard.search.SearchManager.search(SearchManager.java:
 53)
 09:43:42,671 ERROR [STDERR] at
 com
 .xerox
 .mywebboard
 .xeroxArticleSearchPortlet.search(xeroxArticleSearchPortlet.java:45)
 09:43:42,671 ERROR [STDERR] at
 com
 .xerox
 .mywebboard
 .xeroxArticleSearchPortlet
 .processAction(xeroxArticleSearchPortlet.java:27)
 09:43:42,671 ERROR [STDERR] at
 org
 .jboss
 .portal
 .portlet
 .impl
 .jsr168.PortletContainerImpl.invokeAction(PortletContainerImpl.java
 09:43:42,687 ERROR [STDERR] at
 org
 .jboss
 .portal
 .portlet
 .impl 
 .jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:
 401
 09:43:42,687 ERROR [STDERR] at
 org.jboss.portal.portlet.container.PortletContainerInvoker
 $1.invoke(PortletContainerInvoker.java
 09:43:42,687 ERROR [STDERR] at
 org
 .jboss
 .portal.common.invocation.Invocation.invokeNext(Invocation.java

Re: Lucene Error : java.io.FileNotFoundException

2008-07-04 Thread Michael McCandless


I'm not familiar with JBoss' error output, but, maybe this is telling  
you your version of HIbernate is also old (ie depends on Lucene 1.4)?


Mike

yugana wrote:



I see a JAR file at
D:\jboss-portal-2.6.5.GA\server\default\deploy\jboss-portal.sar 
\portal-cms.sar\lib

. when I tried to replace this JAR with the new JAR file, I get the
following errors while restarting the JBoss server.

11:50:10,046 ERROR [URLDeploymentScanner] Incomplete Deployment  
listing:


--- MBeans waiting for other MBeans ---
ObjectName: portal:service=CMS
 State: FAILED
 Reason: java.lang.AbstractMethodError:
org.apache.lucene.store.Directory.openInput(Ljava/lang/String;)Lorg/ 
apache/lucene/store/IndexInput;

 I Depend On:
   jboss.jca:service=DataSourceBinding,name=PortalDS
   portal:service=JAASLoginModule
   portal:service=Hibernate,type=CMS
   cms.pm.cache:service=TreeCache
   portal:service=AuthorizationManager,type=cms
   portal:service=InterceptorStackFactory,type=Cms
 Depends On Me:
   portal:commandFactory=CMSObject

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: portal:service=CMS
 State: FAILED
 Reason: java.lang.AbstractMethodError:
org.apache.lucene.store.Directory.openInput(Ljava/lang/String;)Lorg/ 
apache/lucene/store/IndexInput;

 I Depend On:
   jboss.jca:service=DataSourceBinding,name=PortalDS
   portal:service=JAASLoginModule
   portal:service=Hibernate,type=CMS
   cms.pm.cache:service=TreeCache
   portal:service=AuthorizationManager,type=cms
   portal:service=InterceptorStackFactory,type=Cms
 Depends On Me:
   portal:commandFactory=CMSObject




Michael McCandless-2 wrote:



Are you getting exactly the same error (same source files and exact
same line numbers)?  If so, somehow a Lucene 1.4 JAR is still  
sneaking

in.

Lucene 1.4 won't be able to read an index created by Lucene 2.3.
You'll see exactly that FileNotFoundException because newer versions
of Lucene write to a segments_N file, while 1.4 tries to open just  
the

file "segments".

Mike

yugana wrote:



I have checked all the jars and tried replacing with the same
versions. Still
I get the same error. Please let me know what else to check.

yug


Michael McCandless-2 wrote:



It looks like under JBoss you are accidentally using Lucene 1.4,  
not

2.3.2.

Mike

yugana wrote:



Hi,

I am indexing content and searching using lucene. It is working  
fine

when I
use the simple servlet and jsp mechanism. I am able to search on  
the

indexed
content. I tried to implement the same using JBoss Portal. When I
try to run
the search, I get the below error: Please help me to resolve the
error. I am
using Lucene 2.3.2

09:43:42,671 ERROR [STDERR] java.io.FileNotFoundException:
D:\indexDir\segments (The system cannot find the file specified)
09:43:42,671 ERROR [STDERR] at
java.io.RandomAccessFile.open(Native
Method)
09:43:42,671 ERROR [STDERR] at
java.io.RandomAccessFile.(RandomAccessFile.java:212)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.store.FSInputStream
$Descriptor.(FSDirectory.java:376)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.store.FSInputStream.(FSDirectory.java:405)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.store.FSDirectory.openFile(FSDirectory.java:268)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:40)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.index.IndexReader$1.doBody(IndexReader.java:116)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.store.Lock$With.run(Lock.java:109)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.index.IndexReader.open(IndexReader.java:111)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.index.IndexReader.open(IndexReader.java:95)
09:43:42,671 ERROR [STDERR] at
org.apache.lucene.search.IndexSearcher.(IndexSearcher.java: 
38)

09:43:42,671 ERROR [STDERR] at
com 
.xerox.mywebboard.search.SearchManager.search(SearchManager.java:

53)
09:43:42,671 ERROR [STDERR] at
com
.xerox
.mywebboard
.xeroxArticleSearchPortlet.search(xeroxArticleSearchPortlet.java: 
45)

09:43:42,671 ERROR [STDERR] at
com
.xerox
.mywebboard
.xeroxArticleSearchPortlet
.processAction(xeroxArticleSearchPortlet.java:27)
09:43:42,671 ERROR [STDERR] at
org
.jboss
.portal
.portlet
.impl
.jsr168 
.PortletContainerImpl.invokeAction(PortletContainerImpl.java

09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal
.portlet
.impl
.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:
401
09:43:42,687 ERROR [STDERR] at
org.jboss.portal.portlet.container.PortletContainerInvoker
$1.invoke(PortletContainerInvoker.java
09:43:42,687 ERROR [STDERR] at
org
.jboss
.portal.common.invocation.Invocation.invokeNext(Invocation.java: 
131)

09:43:42,687 ERROR [STDERR] at
org.jboss.portal.core.aspects.portlet.TransactionInterceptor.org
$jboss$portal$core$aspects$portl
09:43:42,687 ERROR [STDERR] at
org.jboss.portal.core.aspects.portlet.TransactionInterceptor
$invokeNotSupported_N454727078796479
09:43:

Re: Search question (newbie)

2008-07-04 Thread Chris Bamford

John,

Thanks, I think I'm getting this now  So you created your own 
BooleanQuery and parsed the string yourself, adding strings as  
TermQuerys etc., rather than using a QueryParser ?


Cheers,

- Chris

John Griffin wrote:

Chris,

I've had similar requirements in the past. First strip the quotes then
create a BooleanQuery consisting of two separate queries.

1. TermQuery for the first term - Fred
2. PrefixQuery for the second term - Flintstone

When you add each individual query to the BooleanQuery make sure the
BooleanClause.Occur parameter is set to MUST (look at the BooleanQuery API
docs). 


Use the toString() method on the BooleanQuery after it's created to make
sure you did it correctly.

John G.

-Original Message-
From: Chris Bamford [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 03, 2008 7:39 AM

To: java-user@lucene.apache.org
Subject: Search question (newbie)

Hi,

Can someone point me in the right direction please?
How can I trap this situation correctly?  I receive user queries like 
this (quotes included):


/from:"fred flintston*"/

Which produces a query string of

/+from:fred  body:flintston/   (where /body/ is the default field)

What I want is:

/+from:fred +from:flintston*/

In other words, I want quoted expressions to be treated as single units..
Thanks for any pointers,

- Chris



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

  



--

*Chris Bamford*
Senior Development Engineer 

/Email / MSN/   [EMAIL PROTECTED]
/Tel/   +44 (0)1344 381814  /Skype/ c.bamford


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



Re: Class in Lucene that Perform Search

2008-07-04 Thread Yonik Seeley
Moving to java-user.

Index the field and use the FieldCache.
You don't want to modify core lucene classes for this common use-case.

-Yonik

On Thu, Jul 3, 2008 at 10:37 PM, blazingwolf7 <[EMAIL PROTECTED]> wrote:
> I am trying to retrieve the contentLength and the URL of each document from
> the index without  continuously using IndexReader, eg:
> reader.document.get("ur");
>
> I am trying to find a way to retrieve all this value and stored it into an
> array by using the IndexReader only once or twice. I thought maybe I can
> store some extra value into the .frq file then I will have no need to
> continuously use the reader. Anyone can provide other suggestion? Thanks
>
>
> Yonik Seeley wrote:
>>
>> On Thu, Jul 3, 2008 at 4:03 AM, blazingwolf7 <[EMAIL PROTECTED]>
>> wrote:
>>> Ah, thanks! I am clear now. Have to change tactics to achieve what I
>>> need.
>>> Which class during indexing time will create the .frq file?
>>
>> DocumentsWriter (called from IndexWriter).
>>
>>> If possible, I want to add an extra value into it so that I can retrieve
>>> the
>>> information during the searching process. Thank
>>
>> Look at payloads first.
>> What problem are you trying to solve?  Someone may have an easier
>> approach for you if payloads doesn't work.
>>
>> -Yonik
>>
>>
>>
>>>
>>> Yonik Seeley wrote:

 On Wed, Jul 2, 2008 at 10:30 PM, blazingwolf7 <[EMAIL PROTECTED]>
 wrote:
> What I am missing is that I fail to locate the class that perform the
> actual
> comparison to determine if a query match any term in a document.

 You need to understand the inverted index format.  Documents that
 match a term is determined at index time, not at query time.  The .frq
 file lists all documents that match each term.

 TermDocs iterates over all documents that match the term by reading
 the .frq file.

 -Yonik

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



>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Class-in-Lucene-that-Perform-Search-tp18250664p18253813.html
>>> Sent from the Lucene - Java Developer mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Class-in-Lucene-that-Perform-Search-tp18250664p18271691.html
> Sent from the Lucene - Java Developer mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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



RE: Search question (newbie)

2008-07-04 Thread John Griffin
Chris,

Yes, when there are multiple types of queries involved (Term & Wildcard in
this case) that's how I handle it. A disadvantage of this is that the user
input must be somewhat restricted since you need to know what's coming.

An important thing to remember is that Wildcard, Prefix and one other I
can't remember at the moment (sorry :>() are not passed through an analyzer.
So, the QueryParser's analyzer has no effect on them.

John G.


-Original Message-
From: Chris Bamford [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 04, 2008 6:10 AM
To: java-user@lucene.apache.org
Subject: Re: Search question (newbie)

John,

Thanks, I think I'm getting this now  So you created your own 
BooleanQuery and parsed the string yourself, adding strings as  
TermQuerys etc., rather than using a QueryParser ?

Cheers,

- Chris

John Griffin wrote:
> Chris,
>
> I've had similar requirements in the past. First strip the quotes then
> create a BooleanQuery consisting of two separate queries.
>
> 1. TermQuery for the first term - Fred
> 2. PrefixQuery for the second term - Flintstone
>
> When you add each individual query to the BooleanQuery make sure the
> BooleanClause.Occur parameter is set to MUST (look at the BooleanQuery API
> docs). 
>
> Use the toString() method on the BooleanQuery after it's created to make
> sure you did it correctly.
>
> John G.
>
> -Original Message-
> From: Chris Bamford [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, July 03, 2008 7:39 AM
> To: java-user@lucene.apache.org
> Subject: Search question (newbie)
>
> Hi,
>
> Can someone point me in the right direction please?
> How can I trap this situation correctly?  I receive user queries like 
> this (quotes included):
>
> /from:"fred flintston*"/
>
> Which produces a query string of
>
> /+from:fred  body:flintston/   (where /body/ is the default field)
>
> What I want is:
>
> /+from:fred +from:flintston*/
>
> In other words, I want quoted expressions to be treated as single units..
> Thanks for any pointers,
>
> - Chris
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>   


-- 

*Chris Bamford*
Senior Development Engineer 

/Email / MSN/   [EMAIL PROTECTED]
/Tel/   +44 (0)1344 381814  /Skype/ c.bamford


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


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



RE: Lucene Error : java.io.FileNotFoundException

2008-07-04 Thread John Griffin
Yug,

In the root directory of your JBoss install there is a file that lists all
the jar files your version of JBoss is guaranteed to work with
(jar-versions.xml). It looks like the jar you're trying to add has a
dependency on another jar that doesn't have what it's looking for.

Get on the JBoss forum and with luck someone will know what else you need to
replace.

John G.

-Original Message-
From: yugana [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 04, 2008 4:12 AM
To: java-user@lucene.apache.org
Subject: Re: Lucene Error : java.io.FileNotFoundException


I see a JAR file at
D:\jboss-portal-2.6.5.GA\server\default\deploy\jboss-portal.sar\portal-cms.s
ar\lib
. when I tried to replace this JAR with the new JAR file, I get the
following errors while restarting the JBoss server.

11:50:10,046 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

--- MBeans waiting for other MBeans ---
ObjectName: portal:service=CMS
  State: FAILED
  Reason: java.lang.AbstractMethodError:
org.apache.lucene.store.Directory.openInput(Ljava/lang/String;)Lorg/apache/l
ucene/store/IndexInput;
  I Depend On:
jboss.jca:service=DataSourceBinding,name=PortalDS
portal:service=JAASLoginModule
portal:service=Hibernate,type=CMS
cms.pm.cache:service=TreeCache
portal:service=AuthorizationManager,type=cms
portal:service=InterceptorStackFactory,type=Cms
  Depends On Me:
portal:commandFactory=CMSObject

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: portal:service=CMS
  State: FAILED
  Reason: java.lang.AbstractMethodError:
org.apache.lucene.store.Directory.openInput(Ljava/lang/String;)Lorg/apache/l
ucene/store/IndexInput;
  I Depend On:
jboss.jca:service=DataSourceBinding,name=PortalDS
portal:service=JAASLoginModule
portal:service=Hibernate,type=CMS
cms.pm.cache:service=TreeCache
portal:service=AuthorizationManager,type=cms
portal:service=InterceptorStackFactory,type=Cms
  Depends On Me:
portal:commandFactory=CMSObject




Michael McCandless-2 wrote:
> 
> 
> Are you getting exactly the same error (same source files and exact  
> same line numbers)?  If so, somehow a Lucene 1.4 JAR is still sneaking  
> in.
> 
> Lucene 1.4 won't be able to read an index created by Lucene 2.3.   
> You'll see exactly that FileNotFoundException because newer versions  
> of Lucene write to a segments_N file, while 1.4 tries to open just the  
> file "segments".
> 
> Mike
> 
> yugana wrote:
> 
>>
>> I have checked all the jars and tried replacing with the same  
>> versions. Still
>> I get the same error. Please let me know what else to check.
>>
>> yug
>>
>>
>> Michael McCandless-2 wrote:
>>>
>>>
>>> It looks like under JBoss you are accidentally using Lucene 1.4, not
>>> 2.3.2.
>>>
>>> Mike
>>>
>>> yugana wrote:
>>>

 Hi,

 I am indexing content and searching using lucene. It is working fine
 when I
 use the simple servlet and jsp mechanism. I am able to search on the
 indexed
 content. I tried to implement the same using JBoss Portal. When I
 try to run
 the search, I get the below error: Please help me to resolve the
 error. I am
 using Lucene 2.3.2

 09:43:42,671 ERROR [STDERR] java.io.FileNotFoundException:
 D:\indexDir\segments (The system cannot find the file specified)
 09:43:42,671 ERROR [STDERR] at
 java.io.RandomAccessFile.open(Native
 Method)
 09:43:42,671 ERROR [STDERR] at
 java.io.RandomAccessFile.(RandomAccessFile.java:212)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.store.FSInputStream
 $Descriptor.(FSDirectory.java:376)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.store.FSInputStream.(FSDirectory.java:405)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.store.FSDirectory.openFile(FSDirectory.java:268)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:40)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.index.IndexReader$1.doBody(IndexReader.java:116)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.store.Lock$With.run(Lock.java:109)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.index.IndexReader.open(IndexReader.java:111)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.index.IndexReader.open(IndexReader.java:95)
 09:43:42,671 ERROR [STDERR] at
 org.apache.lucene.search.IndexSearcher.(IndexSearcher.java:38)
 09:43:42,671 ERROR [STDERR] at
 com.xerox.mywebboard.search.SearchManager.search(SearchManager.java:
 53)
 09:43:42,671 ERROR [STDERR] at
 com
 .xerox
 .mywebboard
 .xeroxArticleSearchPortlet.search(xeroxArticleSearchPortlet.java:45)
 09:43:42,671 ERROR [STDERR] at
 com
 .xerox
 .mywebboard
 .xeroxArticleSearchPortlet
 .processAction(xeroxArticleSearchPortlet.java:27)
 09:43:42,671 ERROR [STDERR] at
 org
 

Re: Search question (newbie)

2008-07-04 Thread Chris Hostetter

: How can I trap this situation correctly?  I receive user queries like this
: (quotes included):
: 
:/from:"fred flintston*"/
: 
: Which produces a query string of
: 
:/+from:fred  body:flintston/   (where /body/ is the default field)

either you've left something out, or some aspect of your situation is 
broken ... passing the string you describe -- including the quotes -- to 
QueryParser will not create an optional clause for body:flinston ... it 
will create a PhraseQuery consisting of whatever Terms are produced by 
your analyzer for the (unquoted) string...
 fred flinston*

...note that the "*" is included in the input passed to your analyzer, 
because it has no special meaning inside quotes.

: What I want is:
: 
: /+from:fred +from:flintston*/

that would require both fred, and something starting with flinston, but it 
wouldn't require them to be close together -- you can achieve that by 
overriding QueryParser.getFieldQuery(String,String).  inspect the 
termText, if it contains something that looks prefix/wildcardish, then 
split the input to get what you want, and delegate to 
QueryParser.getPrefixQuery or getWildCardQuery and then combine up your 
parts into a BooleanQuery.

Or... if you want to take it one step further and require that the clauses 
are near eachother, you can construct a MultiPhraseQuery -- but you'll 
need to have access to an IndexReader in your QueryParser so you can 
expand the prefix/wildcard into it's Terms.


-Hoss


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



Re: too many clauses exception

2008-07-04 Thread Daniel Naber
On Freitag, 4. Juli 2008, Gaurav Sharma wrote:

> I am stuck with an exception in lucene (too many clauses).
> When i am using a wild card such as a* i am getting too many clauses
> exception. It saying maximum clause count is set to 1024. Is there any
> way to increase this count.

Please see
http://wiki.apache.org/lucene-java/LuceneFAQ#head-06fafb5d19e786a50fb3dfb8821a6af9f37aa831

-- 
http://www.danielnaber.de

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



Re: Store/Index Email Address in Lucene

2008-07-04 Thread Karl Wettin
Please show us a couple of examples from the "various type of search"  
you want to be able to handle. The information you supply says nothing  
about your use cases.


In what way do you want to use phrase queries on email addresses? Do  
you want to tokenize parts of a single email address? Or do you want  
to place phrase queries on fields that contains multiple indexed  
single token email addresses? Perhaps a combination? Something else?



 karl

3 jul 2008 kl. 13.31 skrev miztaken:



Hi there,
I want to index email address in such a way that i can do WildCard,  
Phrase

and Simple search on those items.

for each document i will have email addresses string just like in  
the case

of CC and TO in mails.
for eg "[EMAIL PROTECTED]; [EMAIL PROTECTED]; john hopkings;  
[EMAIL PROTECTED]"


Now what is the best way to store them so that i can do various type  
of

search on them.

Do i need the split the email address first and further split the  
single

email address as well and store them in multiple fields?

What is the best way to deal such case?

Your help is highly anticipated

Thank You
miztaken
--
View this message in context: 
http://www.nabble.com/Store-Index-Email-Address-in-Lucene-tp18257247p18257247.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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




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



Re: Multifield Search with OR and AND on different doc Fields

2008-07-04 Thread Karl Wettin

4 jul 2008 kl. 08.30 skrev RanjithStar:




My requirement is to search on SEVEN Fields say F1,F2,F3,F4,F5,F6,F7  
having

F1,F2,F3,F4 on one doc index
and F5,F6,F7 on a different doc index


I need to perform a search with ((F1=9 AND F2=4) AND (F3=keyword OR
F4=keyword)) OR (F5=9 AND F6=4 AND F7=keyword)


For normal search I was doing like this:
String[] sFields = { ID1, ID2, TITLE, CONTENT };
String[] sQuery = { id1, id2, sKeyword, sKeyword };
Occur[] flag = { BooleanClause.Occur.MUST, BooleanClause.Occur.MUST,
BooleanClause.Occur.MUST, BooleanClause.Occur.MUST };

Query oQuery = oMultiParser.parse(sQuery, sFields, flag, oAnalyzer) ;
Hits hits = indexSearcher.search(oQuery);



Do you hav some sort of problem with executing the code above? What  
did you expect it to do and what was the results?





How can I modify the above query in such a way that it has to search  
on

different doc Indexes?



I'm sorry, but I don't understand your question.

You want to know how to search in another directory than the one  
associated with your indexSearcher object?




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



Re: Store/Index Email Address in Lucene

2008-07-04 Thread miztaken

Hi there,

for email addresses string such as "[EMAIL PROTECTED]; jack smith"

I might do wild card search like john* or jack* or [EMAIL PROTECTED] for 
*wherever.com
for phrase search i can do "jack smith"
for general search i might do "[EMAIL PROTECTED]"

I tokenized the string and indexed it into single Field using the Java File,
as mentioned in my earlier post and did searching.
Its working fine.

I want to know what can be the pitfalls of doing like this:
One i know is.. for each string, i should maintain two fields.. one to store
the original string and one that holds tokenized string.

What else ?

Thank You
miztaken


-- 
View this message in context: 
http://www.nabble.com/Store-Index-Email-Address-in-Lucene-tp18257247p18288188.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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