Giter VIP home page Giter VIP logo

Comments (18)

alexbakharew avatar alexbakharew commented on July 22, 2024 1

Hi @son2408!

Unfortunately, it is only possible to gain performance advantage for the order, which is specified in PrimarySort definition.

from arangodb.

alexbakharew avatar alexbakharew commented on July 22, 2024

Hello @son2408 !

Unfortunately, you can specify Primary Sort fields/order only during view creation:

You can only set the primarySort option and the related primarySortCompression and primarySortCache options on View creation.

Here is the documentation page: https://docs.arangodb.com/3.11/index-and-search/arangosearch/performance/#primary-sort-order

To solve your problem, you can switch to the recently implemented Inverted Index and Search Alias View: https://docs.arangodb.com/3.11/index-and-search/arangosearch/search-alias-views-reference/#how-to-use-search-alias-views.

With these new functionality one can achieve your desired scenario:

  1. Create an Inverted Index for the new collection with required Primary Sort settings.
  2. Add this index to Search Alias View - now previously added indexes are not affected.
  3. After adding index you can query view.

If you have any further questions feel free to ask them as well!

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

@alexbakharew thanks you

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

Hello @alexbakharew I can't add new index of a collection into search-alias exists. if I upadate indexes property, it's sync all, I don't expect this.

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

@alexbakharew how to do it ?

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

I have a search-alias with index "idx_1800260331957649408" with collection "a"
image

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

Now, I want add new index of collection b into search-alias "r" exists. I don't affect indexes before :(

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

@alexbakharew by your suggest, I request api update search-alias with this body?

"indexes": [
{
"collection": "a",
"index": "idx_1800260331957649408",
"operation": "string"
},
{
"collection": "b",
"index": "idx_1800288305630150656",
"operation": "string"
}
]

from arangodb.

alexbakharew avatar alexbakharew commented on July 22, 2024

Hello @son2408

if I upadate indexes property, it's sync all, I don't expect this.

Do you mean that the update of the search-alias view with exactly one new index has the same execution time as creating arangosearch view for all collections?

from arangodb.

alexbakharew avatar alexbakharew commented on July 22, 2024

"indexes": [
{
"collection": "a",
"index": "idx_1800260331957649408",
"operation": "string"
},
{
"collection": "b",
"index": "idx_1800288305630150656",
"operation": "string"
}
]

"operation": "string" is incorrect here. https://docs.arangodb.com/3.11/index-and-search/arangosearch/search-alias-views-reference/#view-modification

You can use either "add" or "del". Default value is "add". So in your case you can simply omit it.

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

I receive a message error, do you explain it for me, thanks ?
image

from arangodb.

alexbakharew avatar alexbakharew commented on July 22, 2024

@son2408 I suspect that in these 2 indexes you have different primary sort orders. So the order should be the same in all indexes.

If you mix directions in the primary sort order, the inverted index cannot be utilized for fully optimizing out a matching SORT operation if you use the inverted index standalone.

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

@alexbakharew I want create sort order both asc and desc for a field in Inverted Index. Therefore it causes the above error. If only choose one sort order, I think this it's not reasonable.

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

@alexbakharew. I try create sort order both asc and desc on a field, but i see it only work with asc :(
image
image
image

from arangodb.

alexbakharew avatar alexbakharew commented on July 22, 2024

Hi @son2408!

I want create sort order both asc and desc for a field in Inverted Index. Therefore it causes the above error. If only choose one sort order, I think this it's not reasonable.

Unfortunately, I wasn't able to reproduce this error by specifying different sorting order for the same field. I got this error when I tried to create a view with indexes which have different sorting orders.

Could you please provide collection, indexes and view definitions for more detailed info?

I try create sort order both asc and desc on a field, but i see it only work with asc :(

Under the hood in the index there is no data duplication. It means that we store documents in index only once and apply sorting orders which you have defined in index definition. As a result, your documents in index will be sorted either in ascending or in decreasing order.

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

Hello @alexbakharew. If a field can sort asc or desc, should I index sort this field by your suggestion?

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

@alexbakharew In fact, when client use my application, they want view oldest or lastest data by time. I can't force them only once direct sort

from arangodb.

son2408 avatar son2408 commented on July 22, 2024

@alexbakharew How to index sort a field that I can query sort either in ascending or in decreasing order ? If with a field I create two indexes, one for ascending one for decreasing and if i need index sort for 10 fields i will create 20 indexes. I think this is a bad idea

from arangodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.