lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chaitali Gupta <>
Subject RE: About SolrJ for XML
Date Mon, 05 Oct 2009 22:03:07 GMT

Thanks a lot. It worked!! 

I was wondering if there is a way in SolrJ to print out the size of the index being generated?
Or else how do I determine the total size of the generated index ?


--- On Mon, 10/5/09, Feak, Todd <> wrote:

From: Feak, Todd <>
Subject: RE: About SolrJ for XML
To: "" <>
Date: Monday, October 5, 2009, 5:17 PM

It looks like you have some confusion about queries vs. facets. You may want to look at the
Solr wiki reqarding facets a bit. In the meanwhile, if you just want to query for that field
containing "21"...

I would suggest that you don't set the query type, don't set any facet fields, and only set
the query. Set the query to "field:21" where "field" should be replaced with the fieldname
that has a "21" in it.

For example, if the field name is foo, try this instead:

SolrQuery query = new SolrQuery();
QueryResponse qr = server.query(query);
SolrDocumentList sdl = qr.getResults();

To delve into more detail, what your original code did was query for a "21" in the default
field (check your solrconfig.xml to see what is default). It then faceted the query results
by the "id" field and "weight" fields. Because there were no search results at all, the faceting
request didn't do anything. I'm not sure why you switched the query type to DisMax, as you
didn't issue a query that would leverage it.


-----Original Message-----
From: Chaitali Gupta [] 
Sent: Monday, October 05, 2009 2:05 PM
Subject: About SolrJ for XML 


I am new in Solr. I am using Solr version 1.3 

I would like to index XML files using SolrJ API. I have gone through solr mailing list's emails
and have been able to index XML files. But when I try to query on those files using SolrJ,
I get no output. Especially, I do not find correct results for numeric fields that I have
specified in the schema.xml file in the config directory for my XML files. I have made those
fields "indexed" and "stored" by using "indexed=true" and "stored=true". I am using the following
code  in order to search for data (In the following code, I am trying to find out weight
with values 21) - 

 SolrQuery query = new SolrQuery();
 QueryResponse qr = server.query(query);
 SolrDocumentList sdl = qr.getResults();

Am I doing anything wrong? Why do I get zero results even when there is a XML file with weight
being 21. What are the other ways of doing the numeric queries in SolrJ ? 

Also, I would like to know how do I get the exact size of the index being generated by Solr.
I am using a single machine to generate and query the index. When I look at the index directory,
I see that the size of the files in the index directory is much lesser than the size reported
by the "total" column in "ls -lh" command. Does anyone have any idea why is it the case? 

Thanks in advance. Waiting for your reply soon. 



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message