You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by yz5od2 <wo...@yahoo.com> on 2009/11/15 04:56:02 UTC

Newbie Solr questions

Hi,
I am new to Solr but fairly advanced with lucene.

In the past I have created custom Lucene search engines that indexed  
objects in a Java application, so my background is coming from this  
requirement

a) Since Solr is built on top of lucene, using SolrJ, can I still  
directly create custom documents, specify the field specifics etc  
(indexed, stored etc) and then map POJOs to those documents, simular  
to just using the straight lucene API?

b) I took a quick look at the SolrJ javadocs but did not see anything  
in there that allowed me to customize if a field is stored, indexed,  
not indexed etc. How do I do that with SolrJ without having to go  
directly to the lucene apis?

c) The SolrJ beans package. By annotating a POJO with @Field, how  
exactly does SolrJ treat that field? Indexed/stored, or just indexed?  
Is there any other way to control this?

c) If I create a custom index outside of Solr using straight lucene,  
is it easy to import a pre-exisiting lucene index into a Solr Server?

thanks!

Re: Newbie Solr questions

Posted by Lance Norskog <go...@gmail.com>.
Sorry, I did not answer the question. Yes, that's right. SolrJ can
only change the documents in the index. It has no power over the
metadata.


On Mon, Nov 16, 2009 at 4:00 PM, yz5od2 <wo...@yahoo.com> wrote:
> thanks, so there is no way to create custom documents/field via the SolrJ
> client  API @ runtime.?
>
>
> On Nov 16, 2009, at 4:49 PM, Lance Norskog wrote:
>
>>> here is no way to create custom documents/fields
>>> via the SolrJ client @ runtime.
>
>



-- 
Lance Norskog
goksron@gmail.com

Re: Newbie Solr questions

Posted by yz5od2 <wo...@yahoo.com>.
thanks, so there is no way to create custom documents/field via the  
SolrJ client  API @ runtime.?


On Nov 16, 2009, at 4:49 PM, Lance Norskog wrote:

>> here is no way to create custom documents/fields
>> via the SolrJ client @ runtime.


Re: Newbie Solr questions

Posted by Lance Norskog <go...@gmail.com>.
Solr includes a feature for wild-carding field names. Look for "*_s"
in schema.xml. You can create all of the fields you want but they need
a specific string pattern in the name. There are no restrictions on
the values.

It is a bad practice to create other indexes by hand and import them.
In fact, if you change schema.xml you should re-index the entire
document stream.

On Sun, Nov 15, 2009 at 8:28 PM, yz5od2 <wo...@yahoo.com> wrote:
> ok, so what I am hearing, there is no way to create custom documents/fields
> via the SolrJ client @ runtime. Instead you have to use the schema.xml ahead
> of time OR create a custom index via the lucene APIs then import the indexes
> into Solr for searching?
>
>
>
> On Nov 15, 2009, at 9:16 PM, Peter Wolanin wrote:
>
>> Take a look at the example schema - you can have dynamic fields that
>> are used based on wildcard matching to the field name if a field
>> doesn't mtach the name of an existing field.
>>
>> -Peter
>>
>> On Sun, Nov 15, 2009 at 10:50 AM, yz5od2 <wo...@yahoo.com>
>> wrote:
>>>
>>> Thanks for the reply:
>>>
>>> I follow the schema.xml concept, but what if my requirement is more
>>> dynamic
>>> in nature? I.E. I would like my developers to be able to annotate a POJO
>>> and
>>> submit it to the Solr server (embedded) to be indexed according to public
>>> properties OR annotations. Is that possible?
>>>
>>> If that is not possible, can I programatically define documents and
>>> fields
>>> (and the field options) in straight Java? I.E. in pseudo code below...
>>>
>>> // this is made up but this is what I would like to be able to do
>>> SolrDoc document = new SolrDoc();
>>> SolrField field = new SolrField()
>>> field.isIndexed=true;
>>> field.isStored=true;
>>> field.name = 'myField'
>>>
>>> field.value = myPOJO.getValue();
>>>
>>> solrServer.index(document);
>>>
>>>
>>>
>>>
>>>
>>> On Nov 15, 2009, at 12:50 AM, Avlesh Singh wrote:
>>>
>>>>>
>>>>> a) Since Solr is built on top of lucene, using SolrJ, can I still
>>>>> directly
>>>>> create custom documents, specify the field specifics etc (indexed,
>>>>> stored
>>>>> etc) and then map POJOs to those documents, simular to just using the
>>>>> straight lucene API?
>>>>>
>>>>> b) I took a quick look at the SolrJ javadocs but did not see anything
>>>>> in
>>>>> there that allowed me to customize if a field is stored, indexed, not
>>>>> indexed etc. How do I do that with SolrJ without having to go directly
>>>>> to
>>>>> the lucene apis?
>>>>>
>>>>> c) The SolrJ beans package. By annotating a POJO with @Field, how
>>>>> exactly
>>>>> does SolrJ treat that field? Indexed/stored, or just indexed? Is there
>>>>> any
>>>>> other way to control this?
>>>>>
>>>> The answer to all your questions above is the magical file called
>>>> schema.xml. For more read here - http://wiki.apache.org/solr/SchemaXml.
>>>> SolrJ is simply a java client to access (read and update from) the solr
>>>> server.
>>>>
>>>> c) If I create a custom index outside of Solr using straight lucene, is
>>>> it
>>>>>
>>>>> easy to import a pre-exisiting lucene index into a Solr Server?
>>>>>
>>>> As long as the Lucene index matches the definitions in your schema you
>>>> can
>>>> use the same index. The data however needs to copied into a predictable
>>>> location inside SOLR_HOME.
>>>>
>>>> Cheers
>>>> Avlesh
>>>>
>>>> On Sun, Nov 15, 2009 at 9:26 AM, yz5od2
>>>> <wo...@yahoo.com>wrote:
>>>>
>>>>> Hi,
>>>>> I am new to Solr but fairly advanced with lucene.
>>>>>
>>>>> In the past I have created custom Lucene search engines that indexed
>>>>> objects in a Java application, so my background is coming from this
>>>>> requirement
>>>>>
>>>>> a) Since Solr is built on top of lucene, using SolrJ, can I still
>>>>> directly
>>>>> create custom documents, specify the field specifics etc (indexed,
>>>>> stored
>>>>> etc) and then map POJOs to those documents, simular to just using the
>>>>> straight lucene API?
>>>>>
>>>>> b) I took a quick look at the SolrJ javadocs but did not see anything
>>>>> in
>>>>> there that allowed me to customize if a field is stored, indexed, not
>>>>> indexed etc. How do I do that with SolrJ without having to go directly
>>>>> to
>>>>> the lucene apis?
>>>>>
>>>>> c) The SolrJ beans package. By annotating a POJO with @Field, how
>>>>> exactly
>>>>> does SolrJ treat that field? Indexed/stored, or just indexed? Is there
>>>>> any
>>>>> other way to control this?
>>>>>
>>>>> c) If I create a custom index outside of Solr using straight lucene, is
>>>>> it
>>>>> easy to import a pre-exisiting lucene index into a Solr Server?
>>>>>
>>>>> thanks!
>>>>>
>>>
>>>
>>
>>
>>
>> --
>> Peter M. Wolanin, Ph.D.
>> Momentum Specialist,  Acquia. Inc.
>> peter.wolanin@acquia.com
>
>
>



-- 
Lance Norskog
goksron@gmail.com

Re: Newbie Solr questions

Posted by yz5od2 <wo...@yahoo.com>.
ok, so what I am hearing, there is no way to create custom documents/ 
fields via the SolrJ client @ runtime. Instead you have to use the  
schema.xml ahead of time OR create a custom index via the lucene APIs  
then import the indexes into Solr for searching?



On Nov 15, 2009, at 9:16 PM, Peter Wolanin wrote:

> Take a look at the example schema - you can have dynamic fields that
> are used based on wildcard matching to the field name if a field
> doesn't mtach the name of an existing field.
>
> -Peter
>
> On Sun, Nov 15, 2009 at 10:50 AM, yz5od2 <woods5242- 
> outdoors@yahoo.com> wrote:
>> Thanks for the reply:
>>
>> I follow the schema.xml concept, but what if my requirement is more  
>> dynamic
>> in nature? I.E. I would like my developers to be able to annotate a  
>> POJO and
>> submit it to the Solr server (embedded) to be indexed according to  
>> public
>> properties OR annotations. Is that possible?
>>
>> If that is not possible, can I programatically define documents and  
>> fields
>> (and the field options) in straight Java? I.E. in pseudo code  
>> below...
>>
>> // this is made up but this is what I would like to be able to do
>> SolrDoc document = new SolrDoc();
>> SolrField field = new SolrField()
>> field.isIndexed=true;
>> field.isStored=true;
>> field.name = 'myField'
>>
>> field.value = myPOJO.getValue();
>>
>> solrServer.index(document);
>>
>>
>>
>>
>>
>> On Nov 15, 2009, at 12:50 AM, Avlesh Singh wrote:
>>
>>>>
>>>> a) Since Solr is built on top of lucene, using SolrJ, can I still
>>>> directly
>>>> create custom documents, specify the field specifics etc  
>>>> (indexed, stored
>>>> etc) and then map POJOs to those documents, simular to just using  
>>>> the
>>>> straight lucene API?
>>>>
>>>> b) I took a quick look at the SolrJ javadocs but did not see  
>>>> anything in
>>>> there that allowed me to customize if a field is stored, indexed,  
>>>> not
>>>> indexed etc. How do I do that with SolrJ without having to go  
>>>> directly to
>>>> the lucene apis?
>>>>
>>>> c) The SolrJ beans package. By annotating a POJO with @Field, how  
>>>> exactly
>>>> does SolrJ treat that field? Indexed/stored, or just indexed? Is  
>>>> there
>>>> any
>>>> other way to control this?
>>>>
>>> The answer to all your questions above is the magical file called
>>> schema.xml. For more read here - http://wiki.apache.org/solr/SchemaXml 
>>> .
>>> SolrJ is simply a java client to access (read and update from) the  
>>> solr
>>> server.
>>>
>>> c) If I create a custom index outside of Solr using straight  
>>> lucene, is it
>>>>
>>>> easy to import a pre-exisiting lucene index into a Solr Server?
>>>>
>>> As long as the Lucene index matches the definitions in your schema  
>>> you can
>>> use the same index. The data however needs to copied into a  
>>> predictable
>>> location inside SOLR_HOME.
>>>
>>> Cheers
>>> Avlesh
>>>
>>> On Sun, Nov 15, 2009 at 9:26 AM, yz5od2
>>> <wo...@yahoo.com>wrote:
>>>
>>>> Hi,
>>>> I am new to Solr but fairly advanced with lucene.
>>>>
>>>> In the past I have created custom Lucene search engines that  
>>>> indexed
>>>> objects in a Java application, so my background is coming from this
>>>> requirement
>>>>
>>>> a) Since Solr is built on top of lucene, using SolrJ, can I still
>>>> directly
>>>> create custom documents, specify the field specifics etc  
>>>> (indexed, stored
>>>> etc) and then map POJOs to those documents, simular to just using  
>>>> the
>>>> straight lucene API?
>>>>
>>>> b) I took a quick look at the SolrJ javadocs but did not see  
>>>> anything in
>>>> there that allowed me to customize if a field is stored, indexed,  
>>>> not
>>>> indexed etc. How do I do that with SolrJ without having to go  
>>>> directly to
>>>> the lucene apis?
>>>>
>>>> c) The SolrJ beans package. By annotating a POJO with @Field, how  
>>>> exactly
>>>> does SolrJ treat that field? Indexed/stored, or just indexed? Is  
>>>> there
>>>> any
>>>> other way to control this?
>>>>
>>>> c) If I create a custom index outside of Solr using straight  
>>>> lucene, is
>>>> it
>>>> easy to import a pre-exisiting lucene index into a Solr Server?
>>>>
>>>> thanks!
>>>>
>>
>>
>
>
>
> -- 
> Peter M. Wolanin, Ph.D.
> Momentum Specialist,  Acquia. Inc.
> peter.wolanin@acquia.com



Re: Newbie Solr questions

Posted by Peter Wolanin <pe...@acquia.com>.
Take a look at the example schema - you can have dynamic fields that
are used based on wildcard matching to the field name if a field
doesn't mtach the name of an existing field.

-Peter

On Sun, Nov 15, 2009 at 10:50 AM, yz5od2 <wo...@yahoo.com> wrote:
> Thanks for the reply:
>
> I follow the schema.xml concept, but what if my requirement is more dynamic
> in nature? I.E. I would like my developers to be able to annotate a POJO and
> submit it to the Solr server (embedded) to be indexed according to public
> properties OR annotations. Is that possible?
>
> If that is not possible, can I programatically define documents and fields
> (and the field options) in straight Java? I.E. in pseudo code below...
>
> // this is made up but this is what I would like to be able to do
> SolrDoc document = new SolrDoc();
> SolrField field = new SolrField()
> field.isIndexed=true;
> field.isStored=true;
> field.name = 'myField'
>
> field.value = myPOJO.getValue();
>
> solrServer.index(document);
>
>
>
>
>
> On Nov 15, 2009, at 12:50 AM, Avlesh Singh wrote:
>
>>>
>>> a) Since Solr is built on top of lucene, using SolrJ, can I still
>>> directly
>>> create custom documents, specify the field specifics etc (indexed, stored
>>> etc) and then map POJOs to those documents, simular to just using the
>>> straight lucene API?
>>>
>>> b) I took a quick look at the SolrJ javadocs but did not see anything in
>>> there that allowed me to customize if a field is stored, indexed, not
>>> indexed etc. How do I do that with SolrJ without having to go directly to
>>> the lucene apis?
>>>
>>> c) The SolrJ beans package. By annotating a POJO with @Field, how exactly
>>> does SolrJ treat that field? Indexed/stored, or just indexed? Is there
>>> any
>>> other way to control this?
>>>
>> The answer to all your questions above is the magical file called
>> schema.xml. For more read here - http://wiki.apache.org/solr/SchemaXml.
>> SolrJ is simply a java client to access (read and update from) the solr
>> server.
>>
>> c) If I create a custom index outside of Solr using straight lucene, is it
>>>
>>> easy to import a pre-exisiting lucene index into a Solr Server?
>>>
>> As long as the Lucene index matches the definitions in your schema you can
>> use the same index. The data however needs to copied into a predictable
>> location inside SOLR_HOME.
>>
>> Cheers
>> Avlesh
>>
>> On Sun, Nov 15, 2009 at 9:26 AM, yz5od2
>> <wo...@yahoo.com>wrote:
>>
>>> Hi,
>>> I am new to Solr but fairly advanced with lucene.
>>>
>>> In the past I have created custom Lucene search engines that indexed
>>> objects in a Java application, so my background is coming from this
>>> requirement
>>>
>>> a) Since Solr is built on top of lucene, using SolrJ, can I still
>>> directly
>>> create custom documents, specify the field specifics etc (indexed, stored
>>> etc) and then map POJOs to those documents, simular to just using the
>>> straight lucene API?
>>>
>>> b) I took a quick look at the SolrJ javadocs but did not see anything in
>>> there that allowed me to customize if a field is stored, indexed, not
>>> indexed etc. How do I do that with SolrJ without having to go directly to
>>> the lucene apis?
>>>
>>> c) The SolrJ beans package. By annotating a POJO with @Field, how exactly
>>> does SolrJ treat that field? Indexed/stored, or just indexed? Is there
>>> any
>>> other way to control this?
>>>
>>> c) If I create a custom index outside of Solr using straight lucene, is
>>> it
>>> easy to import a pre-exisiting lucene index into a Solr Server?
>>>
>>> thanks!
>>>
>
>



-- 
Peter M. Wolanin, Ph.D.
Momentum Specialist,  Acquia. Inc.
peter.wolanin@acquia.com

Re: Newbie Solr questions

Posted by yz5od2 <wo...@yahoo.com>.
Thanks for the reply:

I follow the schema.xml concept, but what if my requirement is more  
dynamic in nature? I.E. I would like my developers to be able to  
annotate a POJO and submit it to the Solr server (embedded) to be  
indexed according to public properties OR annotations. Is that possible?

If that is not possible, can I programatically define documents and  
fields (and the field options) in straight Java? I.E. in pseudo code  
below...

// this is made up but this is what I would like to be able to do
SolrDoc document = new SolrDoc();
SolrField field = new SolrField()
field.isIndexed=true;
field.isStored=true;
field.name = 'myField'

field.value = myPOJO.getValue();

solrServer.index(document);





On Nov 15, 2009, at 12:50 AM, Avlesh Singh wrote:

>>
>> a) Since Solr is built on top of lucene, using SolrJ, can I still  
>> directly
>> create custom documents, specify the field specifics etc (indexed,  
>> stored
>> etc) and then map POJOs to those documents, simular to just using the
>> straight lucene API?
>>
>> b) I took a quick look at the SolrJ javadocs but did not see  
>> anything in
>> there that allowed me to customize if a field is stored, indexed, not
>> indexed etc. How do I do that with SolrJ without having to go  
>> directly to
>> the lucene apis?
>>
>> c) The SolrJ beans package. By annotating a POJO with @Field, how  
>> exactly
>> does SolrJ treat that field? Indexed/stored, or just indexed? Is  
>> there any
>> other way to control this?
>>
> The answer to all your questions above is the magical file called
> schema.xml. For more read here - http://wiki.apache.org/solr/ 
> SchemaXml.
> SolrJ is simply a java client to access (read and update from) the  
> solr
> server.
>
> c) If I create a custom index outside of Solr using straight lucene,  
> is it
>> easy to import a pre-exisiting lucene index into a Solr Server?
>>
> As long as the Lucene index matches the definitions in your schema  
> you can
> use the same index. The data however needs to copied into a  
> predictable
> location inside SOLR_HOME.
>
> Cheers
> Avlesh
>
> On Sun, Nov 15, 2009 at 9:26 AM, yz5od2 <woods5242- 
> outdoors@yahoo.com>wrote:
>
>> Hi,
>> I am new to Solr but fairly advanced with lucene.
>>
>> In the past I have created custom Lucene search engines that indexed
>> objects in a Java application, so my background is coming from this
>> requirement
>>
>> a) Since Solr is built on top of lucene, using SolrJ, can I still  
>> directly
>> create custom documents, specify the field specifics etc (indexed,  
>> stored
>> etc) and then map POJOs to those documents, simular to just using the
>> straight lucene API?
>>
>> b) I took a quick look at the SolrJ javadocs but did not see  
>> anything in
>> there that allowed me to customize if a field is stored, indexed, not
>> indexed etc. How do I do that with SolrJ without having to go  
>> directly to
>> the lucene apis?
>>
>> c) The SolrJ beans package. By annotating a POJO with @Field, how  
>> exactly
>> does SolrJ treat that field? Indexed/stored, or just indexed? Is  
>> there any
>> other way to control this?
>>
>> c) If I create a custom index outside of Solr using straight  
>> lucene, is it
>> easy to import a pre-exisiting lucene index into a Solr Server?
>>
>> thanks!
>>


Re: Newbie Solr questions

Posted by Avlesh Singh <av...@gmail.com>.
>
> a) Since Solr is built on top of lucene, using SolrJ, can I still directly
> create custom documents, specify the field specifics etc (indexed, stored
> etc) and then map POJOs to those documents, simular to just using the
> straight lucene API?
>
> b) I took a quick look at the SolrJ javadocs but did not see anything in
> there that allowed me to customize if a field is stored, indexed, not
> indexed etc. How do I do that with SolrJ without having to go directly to
> the lucene apis?
>
> c) The SolrJ beans package. By annotating a POJO with @Field, how exactly
> does SolrJ treat that field? Indexed/stored, or just indexed? Is there any
> other way to control this?
>
The answer to all your questions above is the magical file called
schema.xml. For more read here - http://wiki.apache.org/solr/SchemaXml.
SolrJ is simply a java client to access (read and update from) the solr
server.

c) If I create a custom index outside of Solr using straight lucene, is it
> easy to import a pre-exisiting lucene index into a Solr Server?
>
As long as the Lucene index matches the definitions in your schema you can
use the same index. The data however needs to copied into a predictable
location inside SOLR_HOME.

Cheers
Avlesh

On Sun, Nov 15, 2009 at 9:26 AM, yz5od2 <wo...@yahoo.com>wrote:

> Hi,
> I am new to Solr but fairly advanced with lucene.
>
> In the past I have created custom Lucene search engines that indexed
> objects in a Java application, so my background is coming from this
> requirement
>
> a) Since Solr is built on top of lucene, using SolrJ, can I still directly
> create custom documents, specify the field specifics etc (indexed, stored
> etc) and then map POJOs to those documents, simular to just using the
> straight lucene API?
>
> b) I took a quick look at the SolrJ javadocs but did not see anything in
> there that allowed me to customize if a field is stored, indexed, not
> indexed etc. How do I do that with SolrJ without having to go directly to
> the lucene apis?
>
> c) The SolrJ beans package. By annotating a POJO with @Field, how exactly
> does SolrJ treat that field? Indexed/stored, or just indexed? Is there any
> other way to control this?
>
> c) If I create a custom index outside of Solr using straight lucene, is it
> easy to import a pre-exisiting lucene index into a Solr Server?
>
> thanks!
>