Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8281535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:04:04+00:00 2026-06-08T10:04:04+00:00

I am setting up a small infrastructure that I use to communicate with different

  • 0

I am setting up a small infrastructure that I use to communicate with different search systems (e.g. Apache Solr, SQL DB, etc). For each system I have one individual class (=”communicator”) that implements a common interface, so that the subsequent application can “talk” to all search systems in the same way. Furthermore, each search system has its own class that I use to create the actual query. An object of that individual query class holds all relevant query parameters and is passed to the according communicator class. So for Solr it looks something like this:

Solr solr = new Solr();
SolrQuery sQuery = new SolrQuery();
//use some methods on sQuery to specify the query
var result = solr.query(sQuery);

So far so good. But how do I specify the query-method in the interface? The Solr class expects an object of type SolrQuery. The MySQL class expects an object of type MySQLQuery.

One solution that does what I want is this: I change the whole interface like this:

interface ISearchTechnology<T>
{
  someReturnType query(T queryObject);
}

and then change the class definition of Solr (e.g.) to

class Solr : ISearchTechnology<SolrQuery>

That works. But this makes no sense conceptually. The type SolrQuery is only relevant for this one method (query), not for the whole class. There might be other types (other than SolrQuery, e.g. SolrAnswer) that I need to include. Including all of those like this is confusing and violates my understanding of the concept.

I tried to attach the <T> part to the method in the interface (query<T>(T queryObject)), but I haven’t found any way to actual implement it.

In the end I want to have the following situation: Each communicator class implements the query method as required by the interface, but only accepts one specific type for the parameter that is different from all other communicator classes.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:04:09+00:00Added an answer on June 8, 2026 at 10:04 am

    Your approach with ISearchTechnology<T> is correct, even from conceptual standpoint.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written a small app that creates a GUI for setting up uShare. Currently
I have a small hierarchy of classes that all implement a common interface. Each
I have written a small C program that embeds Python. I'm setting it up
I am setting up a very small MySQL database that stores, first name, last
Setting up paperclip to use S3 on my local dev system was a snap.
Having a small problem for a quick Search and Highlight script that I'm working
I am setting up a github account, to work on a small project with
Setting default values for System Configuration fields is well understood (via Chapagain and blog
I am having a small issue in setting up speed tracer with ubuntu. any
I'm building a small application and setting up foreign key relationships between tables. However

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.