Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Solr have xml alternative to the @Field annotation?

Tags:

java

solr

solrj

  1. I want to use QueryResponse.getBeans()
  2. I have classes defined in another project which does not have solr dependencies, so I can't use @Field on them

Is there an xml (or other externalized) alternative to @Field?

like image 205
Bozho Avatar asked Nov 04 '22 18:11

Bozho


1 Answers

Afaik there is no externalized standard way to this.

But there are probably some ways to achieve what you are trying to do:

  1. Copy solely the annotation to the different project with the same package. And annotate your bean.
  2. It is not possible to set annotations at runtime. These can be solved by using something like a adapter pattern(described here). I would prefer this because in the matter of style it seems to be a pretty clean solution.

Here is the issue about it: Solr are adding more flexibility.

like image 161
fyr Avatar answered Nov 11 '22 03:11

fyr