Call ConfigManager methods

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Call ConfigManager methods

Fr.HarryL
Hello list,

Is it possible to call ConfigManager class from another index_java
custom_method

in order to fetch values from a  translation_maps/foo.properties file ??

Thanks for your answers!

Regards

Harry




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
VuFind-General mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Call ConfigManager methods

Demian Katz
Which version of the code are you working with?

In the latest code, you should be able to access ConfigManager from anywhere by using ConfigManager.instance(). If your custom code is using a different package name than org.vufind.index, you'll need to use

Import org.vufind.index.ConfigManager;

To gain access to the class.

If you're still having trouble, feel free to share an example of non-working code.

- Demian

-----Original Message-----
From: HL [mailto:[hidden email]]
Sent: Wednesday, June 14, 2017 4:45 PM
To: [hidden email]
Subject: [VuFind-General] Call ConfigManager methods

Hello list,

Is it possible to call ConfigManager class from another index_java custom_method

in order to fetch values from a  translation_maps/foo.properties file ??

Thanks for your answers!

Regards

Harry




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsdm.link%2Fslashdot&data=02%7C01%7Cdemian.katz%40villanova.edu%7C6d67bad38e8845b48e8a08d4b36680ed%7C765a8de5cf9444f09cafae5bf8cfa366%7C0%7C0%7C636330700212526656&sdata=YcyUDX7Jcg%2BlNPv2P%2BIfaUyFL%2BQzdt2pPanlQ4jeRTg%3D&reserved=0
_______________________________________________
VuFind-General mailing list
[hidden email]
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fvufind-general&data=02%7C01%7Cdemian.katz%40villanova.edu%7C6d67bad38e8845b48e8a08d4b36680ed%7C765a8de5cf9444f09cafae5bf8cfa366%7C0%7C0%7C636330700212526656&sdata=1n3zV0B45OzgBqrfrS5%2BK%2B68cVcXT6BS9gUkLwQgk7Y%3D&reserved=0

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
VuFind-General mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Call ConfigManager methods

Fr.HarryL
Thanks Demian

I am 3.1.3 from git/master

I call it from /opt/myvf/local/import/.... tree

my index_java is under /opt/myfv/local/import/index_java/src/myorg ..

my foo.properties file is under /opt/myvf/local/import/translation_maps

I had to copy ConfingManager under
/opt/myvf/local/import/index_java/src/org/vufind/index ....

I call it as

     String rel=ConfigManager.instance().getConfigSetting(
"/opt/myvf/local/import/translation_maps/foo.properties","", "070");

Second param is "" , cause I have no [Sections] in my file.

I tried as filepath option from single filename  to fullpath
however java errors  that  cannot find the file...

ERROR [RecordIndexer-Thread-0] (ConfigManager.java:231) - Unable to
access /opt/myvf/......

File exists on file system and all is well for that part.

Regards,
Harry


On 15/06/2017 12:02 πμ, Demian Katz wrote:
> mport org.vufind.index.ConfigManager;


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
VuFind-General mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Call ConfigManager methods

Demian Katz
The ConfigManager is designed to load things out of $VUFIND_LOCAL_DIR/config/vufind. It also expects .ini files rather than Java .properties files. Both of those factors might be causing problems. If you're trying to read a Java .properties file at a known location, there might be an easier way to do that without using the ConfigManager (whose main purpose is to access VuFind's not-so-Java-friendly configurations).

I can try to provide some more specific suggestions if you can say a little more about what you are trying to achieve by reading the configuration....

thanks,
Demian

-----Original Message-----
From: HL [mailto:[hidden email]]
Sent: Thursday, June 15, 2017 12:11 AM
To: Demian Katz; [hidden email]
Subject: Re: [VuFind-General] Call ConfigManager methods

Thanks Demian

I am 3.1.3 from git/master

I call it from /opt/myvf/local/import/.... tree

my index_java is under /opt/myfv/local/import/index_java/src/myorg ..

my foo.properties file is under /opt/myvf/local/import/translation_maps

I had to copy ConfingManager under
/opt/myvf/local/import/index_java/src/org/vufind/index ....

I call it as

     String rel=ConfigManager.instance().getConfigSetting(
"/opt/myvf/local/import/translation_maps/foo.properties","", "070");

Second param is "" , cause I have no [Sections] in my file.

I tried as filepath option from single filename  to fullpath however java errors  that  cannot find the file...

ERROR [RecordIndexer-Thread-0] (ConfigManager.java:231) - Unable to access /opt/myvf/......

File exists on file system and all is well for that part.

Regards,
Harry


On 15/06/2017 12:02 πμ, Demian Katz wrote:
> mport org.vufind.index.ConfigManager;

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
VuFind-General mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Affect order of search results

Daniel Marecek
In reply to this post by Fr.HarryL
Hello list,

is it posibble to affect order of search results?
I mean, for example, to have records with format='Article' at the end of
result list.

Thank you.

Regards
Dan


--
Oddělení ict služeb
Národní technická knihovna
tel: +420 232 002 448

http://www.techlib.cz/


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
VuFind-General mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Affect order of search results

Demian Katz
Yes, you can use boost queries to accomplish this, which you can configure in searchspecs.yaml. To push something to the bottom of the list, you just need to boost everything else.

Here is an example from Villanova's web search:

AllFields:
  DismaxFields:
    - title_unstemmed^800
    - title^750
    - description_unstemmed^350
    - description^300
    - keywords_unstemmed^250
    - keywords^200
    - url_keywords^50
    - fulltext_unstemmed^10
    - fulltext
  DismaxHandler: edismax
  DismaxParams:
    - [bq, cg_archived_str:"no"^20000]
    - [bq, exclude_nav_str:"no"^15000]
    - [bq, category:"Guides"^10]
    - [bf, use_count^0.5]
    - [bf, "recip(ms(NOW/DAY,last_modified),3.16e-11,1,1)^0.5"]

In this example, we're using boost queries to favor non-archived/non-hidden pages by a large margin, with a smaller boost for items in the "Guides" category. We're also using boost functions to favor items that are accessed more frequently and that are newer.

For your example, you probably just need something like:

DismaxParams:
  - [bq, -format:"Article"^10000]

Added to the relevant section(s) of your searchspecs.yaml. Note that the 10000 is an arbitrary number; you may need to use trial and error to find the most appropriate boost factor.

Please let me know if you have questions or problems! (It's possible you'll need to escape or quote differently to make this work in YAML -- apologies if I got the syntax wrong in my example).

- Demian

-----Original Message-----
From: Daniel Mareček [mailto:[hidden email]]
Sent: Thursday, June 22, 2017 9:03 AM
To: [hidden email]
Subject: [VuFind-General] Affect order of search results

Hello list,

is it posibble to affect order of search results?
I mean, for example, to have records with format='Article' at the end of result list.

Thank you.

Regards
Dan


--
Oddělení ict služeb
Národní technická knihovna
tel: +420 232 002 448

https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.techlib.cz%2F&data=02%7C01%7Cdemian.katz%40villanova.edu%7C4ad4c6fda7214a953aa808d4b9716066%7C765a8de5cf9444f09cafae5bf8cfa366%7C0%7C0%7C636337343983463188&sdata=16heHtvPQo36wHNhum8g06nAKi%2F3cQOIrtrC19sG4Iw%3D&reserved=0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsdm.link%2Fslashdot&data=02%7C01%7Cdemian.katz%40villanova.edu%7C4ad4c6fda7214a953aa808d4b9716066%7C765a8de5cf9444f09cafae5bf8cfa366%7C0%7C0%7C636337343983463188&sdata=bd1MGK9Z83HLS%2BR%2FzMq65GVVt9qAQ7kssnPRgvX76TQ%3D&reserved=0
_______________________________________________
VuFind-General mailing list
[hidden email]
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fvufind-general&data=02%7C01%7Cdemian.katz%40villanova.edu%7C4ad4c6fda7214a953aa808d4b9716066%7C765a8de5cf9444f09cafae5bf8cfa366%7C0%7C0%7C636337343983463188&sdata=c%2FPgUy%2BJSIEh04JcXZNxZXIw%2BcfVan%2BCTrHzGeHwdTA%3D&reserved=0

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
VuFind-General mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-general
Loading...