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 8952273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:50:25+00:00 2026-06-15T13:50:25+00:00

It is possibile to to make query where max distance dist is calculated dynamically,

  • 0

It is possibile to to make query where max distance dist is calculated dynamically, depending on what is a field connected with a document being searched.

I mean something like:

ctx.makeCircle(la, lo, DistanceUtils.dist2Degrees(Min(100km, currentDocumnet.getField("max_distance")),DistanceUtils.EARTH_MEAN_RADIUS_KM))

Instead of:

  new SpatialArgs(SpatialOperation.Intersects,ctx.makeCircle(la, lo,   DistanceUtils.dist2Degrees(dist,DistanceUtils.EARTH_MEAN_RADIUS_KM)));

To get the results I want I’m doing some manual filtering on my ScoreDoc:

                String maxDistance = d.get(Offer.MAX_DISTANCE);
                if (maxDistance != null && maxDistance.length() > 0) {
                    logger.info("Contractor max. distance =" + maxDistance);
                    int maxContractorDistance = Integer
                            .parseInt(maxDistance);

                    if (distKM > maxContractorDistance
                            && maxContractorDistance > 0) {
                        logger.info("Contractor is too far"
                                + maxContractorDistance);
                        continue;
                    }

                }
  • 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-15T13:50:26+00:00Added an answer on June 15, 2026 at 1:50 pm

    Ahh; interesting. You should implement this with two spatial filters together. One of them, filters based on the index distance requirement, and the other filters based on the query index requirement.

    The first spatial field should be RecursivePrefixTreeStrategy which is where you should index the circle shapes. When making the query/filter for this field, your query shape is a point. The second spatial field should also use RecursivePrefixTreeStrategy but this one you should index the center points of those circles alone. Your query shape is a circle for this second field. Both queries/filters would alone match more than you want but if you combine them such that a matching document must satisfy both, you will get the correct document set.

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

Sidebar

Related Questions

Is it possible to make one big array from a query like: select array_append(ARRAY[0],
How is it possible to make knockout data-bind work on dynamically generated elements? For
Is it possible to make an Nhibernate query generate Sql that has columnName<>'value' rather
Is it possible to make a simple query to count how many records I
I want to make a query which returns me some values between two dates
Is it possible to make multiple queries at once within the same query? Here
Is it possible to make an Objectify query with a list and get a
It's possible to make a query to see if there is duplicated records in
is it possible to make Lucene query in alfresco that finds nodes based on
is ite possible to make an mysql query in which you get the latest

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.