开发者

Does Solr have xml alternative to the @Field annotation?

  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?


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.


I think this may help you.

http://wiki.apache.org/solr/SchemaXml

In the past I have also created my own versions of the classes from the other project and then provided a transformer to build my versions from the external classes I depend on. This transformer can work both ways and is easily tested.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜