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 <woods5242-outdo...@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 <woods5242-outdo...@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
>>>> <woods5242-outdo...@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.wola...@acquia.com
>
>
>



-- 
Lance Norskog
goks...@gmail.com

Reply via email to