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 ramesh py <py...@gmail.com> on 2013/11/21 07:33:01 UTC

How to retain the original format of input document in search results in SOLR - Tomcat

Hi All,



I am  new to apache solr. Recently  I could able to configure the solr with
tomcat successfully. And its working fine except the format of the search
results i.e., the format of the search results not displaying as like as
input document.



I am doing the below things



1.       Indexing the xml file into solr

2.       Format of the xml as below

*<doc>*

<field name="*F1*">some text</field>

        <field name="*F2*"> Title1: descriptions of the title

Title2 : description of the title2

Title3 : description of title3

</field>

<field name="*F3*">some text </field>

</doc>



3.       After index, the results are displaying in the below format.



*F1 : *some text

*F2*: Title1: descriptions of the title Title2 : description of the title2
Title3 : description of title3

*F3*: some text



*Expected Result :*



*F1 : *some text

*F2*: Title1: descriptions of the title

      Title2 : description of the title2

      Title3 : description of title3

*F3*: some text





If we see the F2 field, format id getting changed i.e., input format is of
F2 field is line by line for each sub title, but in the result it
displaying as single line.





I would like to display the result like whenever any subtitle occurs in xml
file for any field, that subtitle should display in the next  line in the
results.



Can anyone please help on this. Thanks in advance.





Regards,

Ramesh p.y

-- 
Ramesh P.Y
pyramesh16@gmail.com
Mobile No:+91-9176361984

Re: How to retain the original format of input document in search results in SOLR - Tomcat

Posted by pyramesh <py...@gmail.com>.
Thanks Erick for your reply..

I am using velocity template for display the result.

     #field('SDtext')  ==> here SDtext is my field.

here is my field definition in schema.xml

<field name="Resolution" type="text_en" indexed="true"  stored="true" />
<field name="SDtext" type="string" indexed="false" stored="true"
multiValued="false"/>
<copyField source="Resolution" dest="SDtext"/>


<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100"
autoGeneratePhraseQueries="true">
      <analyzer type="index">
		<charFilter class="solr.PatternReplaceCharFilterFactory"  pattern="\n"
replacement="&lt; br &gt;" />
		<tokenizer class="solr.StandardTokenizerFactory"/>
		<filter class="solr.StopFilterFactory" ignoreCase="true"
words="lang/stopwords_en.txt"/>
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="1"
catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
		<filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.KeywordMarkerFilterFactory"
protected="protwords.txt"/>
        <filter class="solr.PorterStemFilterFactory"/>
      </analyzer>
      <analyzer type="query">
	   <tokenizer class="solr.StandardTokenizerFactory"/>
		<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="lang/stopwords_en.txt" />
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="1"
catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.KeywordMarkerFilterFactory"
protected="protwords.txt"/>
        <filter class="solr.PorterStemFilterFactory"/>
		<filter class="solr.TrimFilterFactory" />
      </analyzer>
    </fieldType


<b>Please guide what am I doing wrong ??*

Thanks in advance 



--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-retain-the-original-format-of-input-document-in-search-results-in-SOLR-Tomcat-tp4102327p4103276.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to retain the original format of input document in search results in SOLR - Tomcat

Posted by Erick Erickson <er...@gmail.com>.
Solr (actually Lucene) stores the input _exactly_ as it is entered, and
returns it the same way.

What you're seeing is almost certainly your display mechanism interpreting
the results,
whitespace is notoriously variable in terms of how it's displayed by various
interpretations of the "standard". For instance, HTML often just eats
whitespace.




On Thu, Nov 21, 2013 at 1:33 AM, ramesh py <py...@gmail.com> wrote:

> Hi All,
>
>
>
> I am  new to apache solr. Recently  I could able to configure the solr with
> tomcat successfully. And its working fine except the format of the search
> results i.e., the format of the search results not displaying as like as
> input document.
>
>
>
> I am doing the below things
>
>
>
> 1.       Indexing the xml file into solr
>
> 2.       Format of the xml as below
>
> *<doc>*
>
> <field name="*F1*">some text</field>
>
>         <field name="*F2*"> Title1: descriptions of the title
>
> Title2 : description of the title2
>
> Title3 : description of title3
>
> </field>
>
> <field name="*F3*">some text </field>
>
> </doc>
>
>
>
> 3.       After index, the results are displaying in the below format.
>
>
>
> *F1 : *some text
>
> *F2*: Title1: descriptions of the title Title2 : description of the title2
> Title3 : description of title3
>
> *F3*: some text
>
>
>
> *Expected Result :*
>
>
>
> *F1 : *some text
>
> *F2*: Title1: descriptions of the title
>
>       Title2 : description of the title2
>
>       Title3 : description of title3
>
> *F3*: some text
>
>
>
>
>
> If we see the F2 field, format id getting changed i.e., input format is of
> F2 field is line by line for each sub title, but in the result it
> displaying as single line.
>
>
>
>
>
> I would like to display the result like whenever any subtitle occurs in xml
> file for any field, that subtitle should display in the next  line in the
> results.
>
>
>
> Can anyone please help on this. Thanks in advance.
>
>
>
>
>
> Regards,
>
> Ramesh p.y
>
> --
> Ramesh P.Y
> pyramesh16@gmail.com
> Mobile No:+91-9176361984
>