DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Software Design and Architecture
  3. Performance
  4. Solr 4.0: New 'fl' Parameter Functionalities – First Look

Solr 4.0: New 'fl' Parameter Functionalities – First Look

Rafał Kuć user avatar by
Rafał Kuć
·
Dec. 06, 11 · Interview
Like (0)
Save
Tweet
Share
8.92K Views

Join the DZone community and get the full member experience.

Join For Free

In connection with the work of slowly upcoming release of Apache Solr version 4.0 I thought that it is time to shed some light on the functionalities that you will get into your hands with the release of Apache Solr 4.0. The first change we will look at is a simple, but albeit useful functionality called pseudo fields, together with additional features related to the fl parameter.

Lets begin

The Apache Solr 4.0 has changed slightly how fl parameter can be used. In 4.0 this parameters can be added to the query multiple times and Solr will take all the values into consideration. Sometimes it will be useful, at least in my case.

Custom field names

In Solr 4.0 you will be able to rename fields that are returned in the results. Imagine that, depending on the query we would like rename fields like price_en, price_pl or price_fr to price. In Solr 4.0, we can do this by placing the following query:

fl=price:price_pl

This will cause the field price_pl to be returned as price.

All fields with a common name start

If we want Solr to return the all fields whose name starts with the word price (useful for dynamic fields) all we will need to do is add the following parameter to the query:

fl=price*

Returning function values

The last functionality, which we will look at today, is the ability add the result of the function, as a field in the documents returned by Solr. Thus, in Solr 4.0 will have the option to add such values as sum of prices, or calculated distance between two points. Quite useful. To use this functionality You will have to add the appropriate function call to the fl parameter for example:

fl=*,stock:sum(stockMain,stockShop)

The above will result in Solr returning all the fields for the document (value *) and a field named stock, which will be the sum of two fields: stockShop and stockMain.

A few words at the end

In addition to the new features mentioned above, there is one more thing that is connected to the parameter fl – the DocTransformer. However I decided to leave it for a separate blog post.

Source: solr.pl/en/2011/11/22/solr-4-0-new-fl-parameter-functionalities-first-look

Apache Solr

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Fargate vs. Lambda: The Battle of the Future
  • Use Golang for Data Processing With Amazon Kinesis and AWS Lambda
  • Rust vs Go: Which Is Better?
  • Top 10 Best Practices for Web Application Testing

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: