Re: Query using doc Id

2014-07-23 Thread Mukundaraman Valakumaresan
@Alexandre
No, I mean the same what you mean docId:[100 TO 200]

@Santosh
My intention is to query all the docs from Solr. If I give rows=100start=100,
for which I need to apply my query as *:* , which is not a good idea. Hence
looking for an option to filter based on docId.

Thanks  Regards
Mukund




On Wed, Jul 23, 2014 at 10:43 AM, Alexandre Rafalovitch arafa...@gmail.com
wrote:

 Do you mean something different from docId:[100 TO 200] ?

 Regards,
Alex.
 Personal: http://www.outerthoughts.com/ and @arafalov
 Solr resources: http://www.solr-start.com/ and @solrstart
 Solr popularizers community: https://www.linkedin.com/groups?gid=6713853


 On Wed, Jul 23, 2014 at 11:49 AM, Mukundaraman Valakumaresan
 muk...@8kmiles.com wrote:
  Hi,
 
  Is it possible to execute queries using doc Id as a query parameter
 
  For eg, query docs whose doc Id is between 100 and 200
 
  Thanks  Regards
  Mukund



Re: Query using doc Id

2014-07-23 Thread Mukundaraman Valakumaresan
Exactly Alexandre, Thanks

Regards
Mukund


On Wed, Jul 23, 2014 at 3:37 PM, Alexandre Rafalovitch arafa...@gmail.com
wrote:

 Perhaps you are looking for cursorMark:
 http://solr.pl/en/2014/03/10/solr-4-7-efficient-deep-paging/ ?

 Regards,
Alex.
 Personal: http://www.outerthoughts.com/ and @arafalov
 Solr resources: http://www.solr-start.com/ and @solrstart
 Solr popularizers community: https://www.linkedin.com/groups?gid=6713853


 On Wed, Jul 23, 2014 at 4:59 PM, Mukundaraman Valakumaresan
 muk...@8kmiles.com wrote:
  @Alexandre
  No, I mean the same what you mean docId:[100 TO 200]
 
  @Santosh
  My intention is to query all the docs from Solr. If I give
 rows=100start=100,
  for which I need to apply my query as *:* , which is not a good idea.
 Hence
  looking for an option to filter based on docId.
 
  Thanks  Regards
  Mukund
 
 
 
 
  On Wed, Jul 23, 2014 at 10:43 AM, Alexandre Rafalovitch 
 arafa...@gmail.com
  wrote:
 
  Do you mean something different from docId:[100 TO 200] ?
 
  Regards,
 Alex.
  Personal: http://www.outerthoughts.com/ and @arafalov
  Solr resources: http://www.solr-start.com/ and @solrstart
  Solr popularizers community:
 https://www.linkedin.com/groups?gid=6713853
 
 
  On Wed, Jul 23, 2014 at 11:49 AM, Mukundaraman Valakumaresan
  muk...@8kmiles.com wrote:
   Hi,
  
   Is it possible to execute queries using doc Id as a query parameter
  
   For eg, query docs whose doc Id is between 100 and 200
  
   Thanks  Regards
   Mukund
 



Query using doc Id

2014-07-22 Thread Mukundaraman Valakumaresan
Hi,

Is it possible to execute queries using doc Id as a query parameter

For eg, query docs whose doc Id is between 100 and 200

Thanks  Regards
Mukund


Error uploading csv/json from exampledocs folder

2014-05-27 Thread Mukundaraman valakumaresan
Hi

I am using solr version 4.8. When I uploaded the csv and json provided in
the example docs folder. I am getting a 400 response and the following
exception

Could be a bug...

7955 [searcherExecutor-5-thread-1] INFO  org.apache.solr.core.SolrCore  –
QuerySenderListener sending requests to Searcher@3a5b069c[collection1]
main{StandardDirectoryReader(segments_2:3:nrt _0(4.8):C32)}
7956 [searcherExecutor-5-thread-1] INFO  org.apache.solr.core.SolrCore  –
QuerySenderListener done.
7956 [searcherExecutor-5-thread-1] INFO  org.apache.solr.core.SolrCore  –
[collection1] Registered new searcher Searcher@3a5b069c[collection1]
main{StandardDirectoryReader(segments_2:3:nrt _0(4.8):C32)}
7957 [qtp756319399-19] INFO
 org.apache.solr.update.processor.LogUpdateProcessor  – [collection1]
webapp=/solr path=/update params={commit=true} {commit=} 0 975
11929 [qtp756319399-16] INFO
 org.apache.solr.update.processor.LogUpdateProcessor  – [collection1]
webapp=/solr path=/update params={} {} 0 2
11930 [qtp756319399-16] ERROR org.apache.solr.core.SolrCore  –
org.apache.solr.common.SolrException: Unexpected character '[' (code 91) in
prolog; expected ''
 at [row,col {unknown-source}]: [1,1]
at org.apache.solr.handler.loader.XMLLoader.load(XMLLoader.java:176)
at
org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:92)
at
org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74)
at
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1952)


Re: Error uploading csv/json from exampledocs folder

2014-05-27 Thread Mukundaraman valakumaresan
Yes I am using post .jar

java -jar post.jar *.csv
java -jar post.jar *.json


On Tue, May 27, 2014 at 1:17 PM, Alexandre Rafalovitch
arafa...@gmail.comwrote:

 What's the command line you are using? Or a sequence of steps if you
 are not using post.jar.

 Regards,
Alex.
 Personal website: http://www.outerthoughts.com/
 Current project: http://www.solr-start.com/ - Accelerating your Solr
 proficiency


 On Tue, May 27, 2014 at 2:34 PM, Mukundaraman valakumaresan
 muk...@8kmiles.com wrote:
  Hi
 
  I am using solr version 4.8. When I uploaded the csv and json provided in
  the example docs folder. I am getting a 400 response and the following
  exception
 
  Could be a bug...
 
  7955 [searcherExecutor-5-thread-1] INFO  org.apache.solr.core.SolrCore  –
  QuerySenderListener sending requests to Searcher@3a5b069c[collection1]
  main{StandardDirectoryReader(segments_2:3:nrt _0(4.8):C32)}
  7956 [searcherExecutor-5-thread-1] INFO  org.apache.solr.core.SolrCore  –
  QuerySenderListener done.
  7956 [searcherExecutor-5-thread-1] INFO  org.apache.solr.core.SolrCore  –
  [collection1] Registered new searcher Searcher@3a5b069c[collection1]
  main{StandardDirectoryReader(segments_2:3:nrt _0(4.8):C32)}
  7957 [qtp756319399-19] INFO
   org.apache.solr.update.processor.LogUpdateProcessor  – [collection1]
  webapp=/solr path=/update params={commit=true} {commit=} 0 975
  11929 [qtp756319399-16] INFO
   org.apache.solr.update.processor.LogUpdateProcessor  – [collection1]
  webapp=/solr path=/update params={} {} 0 2
  11930 [qtp756319399-16] ERROR org.apache.solr.core.SolrCore  –
  org.apache.solr.common.SolrException: Unexpected character '[' (code 91)
 in
  prolog; expected ''
   at [row,col {unknown-source}]: [1,1]
  at org.apache.solr.handler.loader.XMLLoader.load(XMLLoader.java:176)
  at
 
 org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:92)
  at
 
 org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74)
  at
 
 org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
  at org.apache.solr.core.SolrCore.execute(SolrCore.java:1952)



Solr Suggester vs Solr SpellChecker

2014-05-27 Thread Mukundaraman valakumaresan
Hi

For auto suggestions I see, that the SpellChecker Component is being used.

In SolrConfig.xml,  I see the following SuggestComponent.  What is the
difference between these 2 components? Which one should be used for Auto
Suggestions.

I could see the SpellChecker component working, any references to use the
SuggesterComponent?

searchComponent name=suggest class=solr.SuggestComponent
  lst name=suggester
  str name=namemySuggester/str
  str name=lookupImplFuzzyLookupFactory/str  !--
org.apache.solr.spelling.suggest.fst --
  str name=dictionaryImplDocumentDictionaryFactory/str !--
org.apache.solr.spelling.suggest.HighFrequencyDictionaryFactory --
  str name=fieldcat/str
  str name=weightFieldprice/str
  str name=suggestAnalyzerFieldTypestring/str
/lst
  /searchComponent

Thanks  Regards
Mukund


Solr Commiter

2014-05-16 Thread Mukundaraman valakumaresan
Hi

How to become a solr committer? Any suggestions?

Regards
Mukund


Passing variables as values in Query Filter

2014-01-07 Thread Mukundaraman valakumaresan
Hi

The following query executes

http://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=locality:Ahttp://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=city:Chennai
dyar

But I wanted something like the one below which is not working.

http://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=locality:$strstrhttp://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=city:$strstr=Chennai
=Adyar

http://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=locality:http://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=city:$strstr=Chennai
getAdjacentLocalities(Adyar)

getAdjacentLocalities() is a custom function implemented.

Any suggestions.

Thanks  Regards
Mukund


Re: Passing variables as values in Query Filter

2014-01-07 Thread Mukundaraman valakumaresan
Hi Ahmet,

Thanks a lot

What I need is this .
q={!lucene df=city v=$qq}qq=customfunc(x)

In this case,
qq=custfunc(x) -- where custfunc is a custom function that has to be
executed. Instead, how it acts now is, it takes it as a string to search
if qq  is a number, you will get a NumberFormatException

Thanks  Regards
Mukund



On Tue, Jan 7, 2014 at 7:45 PM, Ahmet Arslan iori...@yahoo.com wrote:

 Hi Mukund,

 I am not sure what you are after but may be you can use this : q={!lucene
 df=city v=$qq}qq=Adyar



 https://cwiki.apache.org/confluence/display/solr/Local+Parameters+in+Queries

 Ahmet




 On Tuesday, January 7, 2014 3:39 PM, Mukundaraman valakumaresan 
 muk...@8kmiles.com wrote:
 Hi

 The following query executes


 http://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=locality:A
 
 http://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=city:Chennai
 
 dyar

 But I wanted something like the one below which is not working.


 http://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=locality:$strstr
 
 http://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=city:$strstr=Chennai
 
 =Adyar


 http://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=locality
 :
 http://localhost:8983/solr/collection1/select?wt=jsonindent=trueq=city:$strstr=Chennai
 
 getAdjacentLocalities(Adyar)

 getAdjacentLocalities() is a custom function implemented.

 Any suggestions.

 Thanks  Regards
 Mukund




Reading Config files Solr

2013-12-19 Thread Mukundaraman valakumaresan
Hi

Is it possible to read configuration properties inside Solr

For eg.i have a property file
F:\solr\example\solr\collection1\conf\test.properties within which I have
lots of key,
value entries.

Is there a way to read this file using a relative path and use it inside a
custom function

Thanks  Regards
Mukund


Re: External File Field

2013-12-17 Thread Mukundaraman valakumaresan
Hi

it works, thanks a lot.

Regards
Mukund


On Tue, Dec 17, 2013 at 5:20 PM, Ahmet Arslan iori...@yahoo.com wrote:

 Hi,

 I see that you defined fieldType correctly. However you need to a field of
 that type too.

 field name=adjlocality type=adjlocality  /


 Your file name should be external_adjlocality.txt

 With above configuration everything should work. Verify it by
 q=*:*fl=*,field(adjlocality)





 On Tuesday, December 17, 2013 9:02 AM, Mukundaraman valakumaresan 
 muk...@8kmiles.com wrote:
 Hi


 http://localhost:8983/solr/collection1/select?wt=jsonomitHeader=onindent=truedefType=edismaxfl=id,property_price_max,locality,property_price_min,field(adjlocality)q=*:*
 
 http://localhost:8983/solr/collection1/select?wt=jsonomitHeader=onindent=truedefType=edismaxfl=id,property_price_max,locality,property_price_min,norm:pricenorm(1000,10,property_price_median),field(adjlocality)q=*:*
 

 I did it, it is giving me a message underfined field.

 I have placed my files at F:\solr\example\solr\collection1\data where the
 Solr data is maintained.

 Is there a way to check whether the files are read or not?

 Thanks  Regards
 Mukund




 On Mon, Dec 16, 2013 at 8:48 PM, Ahmet Arslan iori...@yahoo.com wrote:

  Hi,
 
  You can request the value of the that field via fl=*,field(adjlocality)
 
  See more about it :
 
 https://cwiki.apache.org/confluence/display/solr/Working+with+External+Files+and+Processes
 
  Actually you can search it too with frange query parser. {!frange l=0
  u=0}field(adjlocality)
 
 
 
 
  On Monday, December 16, 2013 5:05 PM, Mukundaraman valakumaresan 
  muk...@8kmiles.com wrote:
  Hi
 
  Is there a way to find ,whether the External File Fields mentioned in the
  schema.xml is being used or whether Solr reads the value of those
 external
  fields.
 
  I am not sure how to use an External field, can I request the value of an
  External File Field in the field list or can I use in my custom function
 as
  shown below:
 
 
 
 http://localhost:8983/solr/collection1/select?wt=jsonomitHeader=onindent=truedefType=edismaxfl=id,adjlocality
  
 
 http://localhost:8983/solr/collection1/select?wt=jsonomitHeader=onindent=truedefType=edismaxfl=id,property_price_max,property_price_min,lanorm(%22%22,luxury_amenities_c,10),adjlocality
  
  ,custfunc(adjlocality).
 
  I didn't get any output for the external fields in the queries that I
  provide.
 
  Thanks  Regards
  Mukund
 



External File Field

2013-12-16 Thread Mukundaraman valakumaresan
Hi

Is there a way to find ,whether the External File Fields mentioned in the
schema.xml is being used or whether Solr reads the value of those external
fields.

I am not sure how to use an External field, can I request the value of an
External File Field in the field list or can I use in my custom function as
shown below:

http://localhost:8983/solr/collection1/select?wt=jsonomitHeader=onindent=truedefType=edismaxfl=id,adjlocalityhttp://localhost:8983/solr/collection1/select?wt=jsonomitHeader=onindent=truedefType=edismaxfl=id,property_price_max,property_price_min,lanorm(%22%22,luxury_amenities_c,10),adjlocality
,custfunc(adjlocality).

I didn't get any output for the external fields in the queries that I
provide.

Thanks  Regards
Mukund


Re: External File Field

2013-12-16 Thread Mukundaraman valakumaresan
Hi

http://localhost:8983/solr/collection1/select?wt=jsonomitHeader=onindent=truedefType=edismaxfl=id,property_price_max,locality,property_price_min,field(adjlocality)q=*:*http://localhost:8983/solr/collection1/select?wt=jsonomitHeader=onindent=truedefType=edismaxfl=id,property_price_max,locality,property_price_min,norm:pricenorm(1000,10,property_price_median),field(adjlocality)q=*:*

I did it, it is giving me a message underfined field.

I have placed my files at F:\solr\example\solr\collection1\data where the
Solr data is maintained.

Is there a way to check whether the files are read or not?

Thanks  Regards
Mukund



On Mon, Dec 16, 2013 at 8:48 PM, Ahmet Arslan iori...@yahoo.com wrote:

 Hi,

 You can request the value of the that field via fl=*,field(adjlocality)

 See more about it :
 https://cwiki.apache.org/confluence/display/solr/Working+with+External+Files+and+Processes

 Actually you can search it too with frange query parser. {!frange l=0
 u=0}field(adjlocality)




 On Monday, December 16, 2013 5:05 PM, Mukundaraman valakumaresan 
 muk...@8kmiles.com wrote:
 Hi

 Is there a way to find ,whether the External File Fields mentioned in the
 schema.xml is being used or whether Solr reads the value of those external
 fields.

 I am not sure how to use an External field, can I request the value of an
 External File Field in the field list or can I use in my custom function as
 shown below:


 http://localhost:8983/solr/collection1/select?wt=jsonomitHeader=onindent=truedefType=edismaxfl=id,adjlocality
 
 http://localhost:8983/solr/collection1/select?wt=jsonomitHeader=onindent=truedefType=edismaxfl=id,property_price_max,property_price_min,lanorm(%22%22,luxury_amenities_c,10),adjlocality
 
 ,custfunc(adjlocality).

 I didn't get any output for the external fields in the queries that I
 provide.

 Thanks  Regards
 Mukund



Re: Getting Solr Document Attributes from a Custom Function

2013-12-12 Thread Mukundaraman valakumaresan
Hi

Thanks a lot , that helps

Regards
Mukund


On Thu, Dec 12, 2013 at 1:18 AM, Kydryavtsev Andrey werde...@yandex.ruwrote:

 As I know (not 100% sure actually), function queries don't work with
 multivalued fields. Why do you need multivalued fields here? Your price
 and numberOfCities don't look like multivalued. At least you can try to
 use, you know, some tricky format like
 50;40;20 to index multivalued field as single-valued and then parse this
 into values list in function.

 11.12.2013, 11:13, Mukundaraman valakumaresan muk...@8kmiles.com:
  Hi Kydryavtsev
 
  Thanks a lot it works,  but how do i pass a multivalued field values to a
  function query?
 
  Can it be passed as a String array?
 
  Thanks  Regards
  Mukund
 
  On Tue, Dec 10, 2013 at 12:05 PM, Kydryavtsev Andrey werde...@yandex.ru
 wrote:
 
   You can implement it in this way:
   Index number of cities as new int field (like field
   name=numberOfCities2/field) and implement user function like
 
   customFunction(price, numberOfCities, 1, 2000, 5)
 
   Custom parser should parse this into value sources list. From first two
   field sources we can get per doc value for this particular fields,
 another
   three will be ConstValueSource instances - just constants, so we can
 access
   all 5 values and implement custom formula per doc id. Find examples in
   ValueSourceParser and solr functions like DefFunction or
 MinFloatFunction
 
   10.12.2013, 09:31, Mukundaraman valakumaresan muk...@8kmiles.com:
   Hi Hoss,
 
   Thanks a lot for your response. The actual problem is,
 
   For every record that I query, I have to execute a formula and sort
 the
   records based on the value of the formula.
   The formula has elements from the record.
 
   For eg. for the following document ,I need to apply the formula
   (maxprice -
   solrprice)/ (maxprice - minprice)  +  count(cities)/totalcities.
   where maxprice, maxprice and total cities will be available at run
 time.
 
   So for the following record, it has to execute as  (1 -
   *5000*)/(1-2000)
   + *2*/5   (where 5000 and 2, which are in bold are from the document)
 
   doc
   field name=idapartment_1/field
   field name=nameCasa Grande/field
   field name=localitychennai/field
   field name=localitybangalore/field
   field name=price5000/field
   /doc
 
   Thanks  Regards
   Mukund
 
   On Tue, Dec 10, 2013 at 12:22 AM, Chris Hostetter
   hossman_luc...@fucit.orgwrote:
Smells like an XY problem ...
 
Can you please describe what your end goal is in writing a custom
function, and what you would do with things like the name field
   inside
your funciton?
 
In general, accessing stored field values for indexed documents ca
 be
prohibitively expensive, it rather defeats the entire point of the
inverted index data structure.  If you help us understand what your
   goal
is, people may be able to offer performant suggestions.
 
https://people.apache.org/~hossman/#xyproblem
XY Problem
 
Your question appears to be an XY Problem ... that is: you are
   dealing
with X, you are assuming Y will help you, and you are asking
 about
   Y
without giving more details about the X so that we can understand
 the
full issue.  Perhaps the best solution doesn't involve Y at all?
See Also: http://www.perlmonks.org/index.pl?node_id=542341
 
: Date: Mon, 9 Dec 2013 20:24:15 +0530
: From: Mukundaraman valakumaresan muk...@8kmiles.com
: Reply-To: solr-user@lucene.apache.org
: To: solr-user@lucene.apache.org
: Subject: Getting Solr Document Attributes from a Custom Function
:
: Hi All,
:
: I have a written a custom solr function and I would like to read a
property
: of the document inside my custom function. Is it possible to get
 that
using
: Solr?
:
: For eg. inside the floatVal method, I would like to get the value
 of
   the
: attribute name
:
: public class CustomValueSource extends ValueSource {
:
: @Override
: public FunctionValues getValues(Map context,
: AtomicReaderContext readerContext) throws IOException {
:  return new FloatDocValues(this) { @Override public float
   floatVal(int
doc)
: {
: /***
:  getDocument(doc).getAttribute(name)
:
: / }}}
:
: Thanks  Regards
: Mukund
:
 
-Hoss
http://www.lucidworks.com/



Re: custom group sort in solr

2013-12-12 Thread Mukundaraman valakumaresan
Hi

You may try to write a custom function and sort your group according to the
result of the custom function.

If that might work, check out ValueSourceParser, ValueSource and its
descendant classes for a better understanding.

Thanks  Regards
Mukund


On Fri, Dec 13, 2013 at 10:54 AM, Parvesh Garg parv...@zettata.com wrote:

 Hi,

 I want to use solr/lucene's grouping feature with a some customisations
 like

- sorting the groups based on average scores instead of max scores or
some other complex computation over scores.
- group articles based on some computation instead of a field value.

 So far it seems like I have to write some code for it. Can someone please
 point me to the right direction?

- If I have to write a plugin, which files I need to check?
- Which part of the code currently executes the grouping feature? Does
it happen in solr or lucene? Is it SearchHandler?

 Parvesh Garg
 http://www.zettata.com



Re: Getting Solr Document Attributes from a Custom Function

2013-12-10 Thread Mukundaraman valakumaresan
Hi Kydryavtsev

Thanks a lot it works,  but how do i pass a multivalued field values to a
function query?

Can it be passed as a String array?

Thanks  Regards
Mukund


On Tue, Dec 10, 2013 at 12:05 PM, Kydryavtsev Andrey werde...@yandex.ruwrote:

 You can implement it in this way:
 Index number of cities as new int field (like field
 name=numberOfCities2/field) and implement user function like

 customFunction(price, numberOfCities, 1, 2000, 5)

 Custom parser should parse this into value sources list. From first two
 field sources we can get per doc value for this particular fields, another
 three will be ConstValueSource instances - just constants, so we can access
 all 5 values and implement custom formula per doc id. Find examples in
 ValueSourceParser and solr functions like DefFunction or MinFloatFunction

 10.12.2013, 09:31, Mukundaraman valakumaresan muk...@8kmiles.com:
  Hi Hoss,
 
  Thanks a lot for your response. The actual problem is,
 
  For every record that I query, I have to execute a formula and sort the
  records based on the value of the formula.
  The formula has elements from the record.
 
  For eg. for the following document ,I need to apply the formula
 (maxprice -
  solrprice)/ (maxprice - minprice)  +  count(cities)/totalcities.
  where maxprice, maxprice and total cities will be available at run time.
 
  So for the following record, it has to execute as  (1 -
  *5000*)/(1-2000)
  + *2*/5   (where 5000 and 2, which are in bold are from the document)
 
  doc
  field name=idapartment_1/field
  field name=nameCasa Grande/field
  field name=localitychennai/field
  field name=localitybangalore/field
  field name=price5000/field
  /doc
 
  Thanks  Regards
  Mukund
 
  On Tue, Dec 10, 2013 at 12:22 AM, Chris Hostetter
  hossman_luc...@fucit.orgwrote:
 
   Smells like an XY problem ...
 
   Can you please describe what your end goal is in writing a custom
   function, and what you would do with things like the name field
 inside
   your funciton?
 
   In general, accessing stored field values for indexed documents ca be
   prohibitively expensive, it rather defeats the entire point of the
   inverted index data structure.  If you help us understand what your
 goal
   is, people may be able to offer performant suggestions.
 
   https://people.apache.org/~hossman/#xyproblem
   XY Problem
 
   Your question appears to be an XY Problem ... that is: you are
 dealing
   with X, you are assuming Y will help you, and you are asking about
 Y
   without giving more details about the X so that we can understand the
   full issue.  Perhaps the best solution doesn't involve Y at all?
   See Also: http://www.perlmonks.org/index.pl?node_id=542341
 
   : Date: Mon, 9 Dec 2013 20:24:15 +0530
   : From: Mukundaraman valakumaresan muk...@8kmiles.com
   : Reply-To: solr-user@lucene.apache.org
   : To: solr-user@lucene.apache.org
   : Subject: Getting Solr Document Attributes from a Custom Function
   :
   : Hi All,
   :
   : I have a written a custom solr function and I would like to read a
   property
   : of the document inside my custom function. Is it possible to get that
   using
   : Solr?
   :
   : For eg. inside the floatVal method, I would like to get the value of
 the
   : attribute name
   :
   : public class CustomValueSource extends ValueSource {
   :
   : @Override
   : public FunctionValues getValues(Map context,
   : AtomicReaderContext readerContext) throws IOException {
   :  return new FloatDocValues(this) { @Override public float
 floatVal(int
   doc)
   : {
   : /***
   :  getDocument(doc).getAttribute(name)
   :
   : / }}}
   :
   : Thanks  Regards
   : Mukund
   :
 
   -Hoss
   http://www.lucidworks.com/



Getting Solr Document Attributes from a Custom Function

2013-12-09 Thread Mukundaraman valakumaresan
Hi All,

I have a written a custom solr function and I would like to read a property
of the document inside my custom function. Is it possible to get that using
Solr?

For eg. inside the floatVal method, I would like to get the value of the
attribute name

public class CustomValueSource extends ValueSource {

@Override
public FunctionValues getValues(Map context,
AtomicReaderContext readerContext) throws IOException {
 return new FloatDocValues(this) { @Override public float floatVal(int doc)
{
/***
 getDocument(doc).getAttribute(name)

/ }}}

Thanks  Regards
Mukund


Re: Getting Solr Document Attributes from a Custom Function

2013-12-09 Thread Mukundaraman valakumaresan
Hi Hoss,

Thanks a lot for your response. The actual problem is,

For every record that I query, I have to execute a formula and sort the
records based on the value of the formula.
The formula has elements from the record.

For eg. for the following document ,I need to apply the formula (maxprice -
solrprice)/ (maxprice - minprice)  +  count(cities)/totalcities.
where maxprice, maxprice and total cities will be available at run time.

So for the following record, it has to execute as  (1 -
*5000*)/(1-2000)
+ *2*/5   (where 5000 and 2, which are in bold are from the document)

doc
field name=idapartment_1/field
field name=nameCasa Grande/field
field name=localitychennai/field
field name=localitybangalore/field
field name=price5000/field
/doc

Thanks  Regards
Mukund



On Tue, Dec 10, 2013 at 12:22 AM, Chris Hostetter
hossman_luc...@fucit.orgwrote:


 Smells like an XY problem ...

 Can you please describe what your end goal is in writing a custom
 function, and what you would do with things like the name field inside
 your funciton?

 In general, accessing stored field values for indexed documents ca be
 prohibitively expensive, it rather defeats the entire point of the
 inverted index data structure.  If you help us understand what your goal
 is, people may be able to offer performant suggestions.



 https://people.apache.org/~hossman/#xyproblem
 XY Problem

 Your question appears to be an XY Problem ... that is: you are dealing
 with X, you are assuming Y will help you, and you are asking about Y
 without giving more details about the X so that we can understand the
 full issue.  Perhaps the best solution doesn't involve Y at all?
 See Also: http://www.perlmonks.org/index.pl?node_id=542341




 : Date: Mon, 9 Dec 2013 20:24:15 +0530
 : From: Mukundaraman valakumaresan muk...@8kmiles.com
 : Reply-To: solr-user@lucene.apache.org
 : To: solr-user@lucene.apache.org
 : Subject: Getting Solr Document Attributes from a Custom Function
 :
 : Hi All,
 :
 : I have a written a custom solr function and I would like to read a
 property
 : of the document inside my custom function. Is it possible to get that
 using
 : Solr?
 :
 : For eg. inside the floatVal method, I would like to get the value of the
 : attribute name
 :
 : public class CustomValueSource extends ValueSource {
 :
 : @Override
 : public FunctionValues getValues(Map context,
 : AtomicReaderContext readerContext) throws IOException {
 :  return new FloatDocValues(this) { @Override public float floatVal(int
 doc)
 : {
 : /***
 :  getDocument(doc).getAttribute(name)
 :
 : / }}}
 :
 : Thanks  Regards
 : Mukund
 :

 -Hoss
 http://www.lucidworks.com/