Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Setting limit for the no. of words per record in solr while fetching

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 349
    Comment on it

    Fetching records in solr:

    Once you have finished with indexing in solr, now you can perform search on your records with the help of queries.

    Go to the url:

    http://localhost:8983/solr/#/collection/query 

    There is box with q, here you can query for your records. For fetching all records we write *:* and execute the queries, the records will be fetched accordingly.

    Limiting the records based on the no. of word per record:

    Suppose we have indexed this file example.xml

    <add>
      <doc>
        
        <field name="record1">
      This is an example.This is an example.This is an example.</field>
      <field name="record2">This is an example.This is an example.This is an example.This is an example.</field>
     </doc>
      <doc>
        
        <field name="record1">
      This is an example.</field>
      <field name="record2">This is an example.</field>
     </doc>
      <doc>
        
        <field name="record1">
      This is example </field>
      <field name="record2">This is an example.This is an example.This is an example.This is an example.</field>
     </doc>
      <doc>
        
        <field name="record1">
      This is an example.This is an example</field>
      <field name="record2">Example</field>
     </doc>
      <doc>
        
        <field name="record1">
      This is an example.This is an example</field>
      <field name="record2">This is an example.This is an example.This is an example.This is an example.</field>
     </doc>
    </add>
    

    If you want to fetch the records from the field named record1 which should not be more than fifteen characters than you can write a filter query along with main query using regex:

    /.{0,14}./

    so the filter query will be:

     record1:/.{0,14}./

     and if you want to specify the least no. of words, suppose at least 15 should be there per record, then you can use the regex:

    /.{15}./

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: