Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hibernate Search dev console card for multi-persistence-unit applications #14729

Closed
yrodiere opened this issue Feb 1, 2021 · 15 comments · Fixed by #25578
Closed

Hibernate Search dev console card for multi-persistence-unit applications #14729

yrodiere opened this issue Feb 1, 2021 · 15 comments · Fixed by #25578
Labels
area/hibernate-search Hibernate Search good first issue Good for newcomers kind/enhancement New feature or request
Milestone

Comments

@yrodiere
Copy link
Member

yrodiere commented Feb 1, 2021

Description
The dev console card for Hibernate Search, added in #14622, only works for the default persistence unit. It would be nice to make it work with applications that have multiple persistence units.

Implementation ideas
TBD.

@yrodiere yrodiere added the kind/enhancement New feature or request label Feb 1, 2021
@ghost ghost added the area/hibernate-search Hibernate Search label Feb 1, 2021
@ghost
Copy link

ghost commented Feb 1, 2021

/cc @gsmet

@rahljoshi
Copy link

Can I work on this I am a beginner it would be helpful if you can share some follow-ups for me, thanks!

@yrodiere
Copy link
Member Author

yrodiere commented Mar 5, 2021

Sure, here are some hints.

The problem

  • Start the Hibernate Search quickstart locally (see the readme), and go to http://localhost:8080/q/dev/
  • What you're seeing are the Dev UI cards. There is one card about Hibernate Search. It indicates there are two indexed types, and if you click that badge you will be redirected to a page to reindex these types.
  • The problem is that only covers the default persistence unit, and Quarkus allows multiple persistence units. Currently, even if there are multiple persistence units, the card will only display information about the default one.

Where to change things

  • io.quarkus.hibernate.search.orm.elasticsearch.runtime.devconsole.HibernateSearchSupplier#searchMapping returns a SearchMapping, which is basically the representation of a persistence unit in Hibernate Search. Currently it returns the mapping for the default persistence unit, and that will have to change, somehow.
  • io.quarkus.hibernate.search.orm.elasticsearch.runtime.devconsole.HibernateSearchDevConsoleRecorder#indexEntity is an HTTP request handler, and it currently has no clue about the persistence unit it should be working on. It should be made aware of that, through an additional parameter.
  • extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates is where you'll find the HTML templates for the UI part. Those will have to change to have 1 badge per persistence unit, and to make the page (entity-types.html) aware of which persistence unit it's displaying (pass a path parameter?).
  • To get a list of all persistence units, change io.quarkus.hibernate.search.orm.elasticsearch.devconsole.DevConsoleProcessor#collectBeanInfo by adding a parameter of type List<HibernateSearchElasticsearchPersistenceUnitConfiguredBuildItem>. It will get populated automatically. Then you can turn it into a List<String> containing the persistence unit names, and pass it to the constructor of HibernateSearchSupplier.

@SubhasmitaSw
Copy link

SubhasmitaSw commented Mar 10, 2021

@yrodiere I was goin through this issue to reproduce it, while building the demo for Hibernate Search quickstart I'm facing an error , I'm new to this domain so it would be helpful if you could point out where I'm mistaken to resolve the issue.

I'm attaching herewith the error produced.

image

@yrodiere
Copy link
Member Author

I don't know about this error, but it's not necessary to run all quickstarts anyway. Just go into the hibernate-search-orm-elasticsearch-quickstart directory and run the commands from there.

@SubhasmitaSw
Copy link

SubhasmitaSw commented May 26, 2021

@yrodiere Hello, I had been occupied with health issues for some time now, I'd now continue with this issue, should I make a thread for this particular issue in Zulip?

@yrodiere
Copy link
Member Author

@SubhasmitaSw Hello. Sorry to hear that. If you need help on something related specifically to this issue, sure.

@SubhasmitaSw
Copy link

@yrodiere I've started a thread on zulip, please check it out.

@keshavcodex
Copy link

@yrodiere I've started a thread on zulip, please check it out.

(beginner) i am not able to find the thread, can you please tell me how to find, or send the link.

@keshavcodex
Copy link

I don't know about this error, but it's not necessary to run all quickstarts anyway. Just go into the hibernate-search-orm-elasticsearch-quickstart directory and run the commands from there.

sir, i have reached here extensions/hibernate-search-orm-elasticsearch/ and searching the hibernate-search-orm-elasticsearch-quickstart but i am not able to find can you help me, i am new here.

@yrodiere
Copy link
Member Author

yrodiere commented Jun 8, 2021

Please read my original comment. The quickstarts are in a different repository, and I included a link to that repository.

@SubhasmitaSw
Copy link

SubhasmitaSw commented Jun 9, 2021

@keshavcodex Here's the link to the thread.

@mun711
Copy link
Contributor

mun711 commented May 10, 2022

Hey,
I'm new to quarkus and would like to contribute
There seems to be no activity on this issue for quite some time, so can it be taken or there is someone already working on this ?
@yrodiere @keshavcodex

@yrodiere
Copy link
Member Author

Hi. It's been a year, so I think we can safely assume @keshavcodex stopped working on this. Feel free to give it a try. All the necessary information should be in the previous messages. Enjoy :)

@mun711
Copy link
Contributor

mun711 commented May 14, 2022

Opened a wip pr for the changes ( #25578) , currently it's a bit different from the suggestions mentioned above:

  • Didn't add multiple hibernate search cards per persistence unit, but rather added multiple tables on the page referenced by the card (it seems that this kind of grouping is used for other cards that display some multi pu data)
  • regarding the indexing, it will check and reindex the selected classes if found in the search mapping using the jpa entity name, should I add an explicit expectation for the pu or use the full class name? Not sure if we can have entities with same name across multiple persistence units

@yrodiere Please let me know what you think and I'll add other changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-search Hibernate Search good first issue Good for newcomers kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants